/* 终末地排轴: industrial file look. A black frame (left rail + top band), signal yellow for "selected / do this",
   concrete grey ground, sharp-cornered panels with a tab mark, DIN-like numerals (Barlow). */
@font-face { font-family: "Barlow Condensed"; font-weight: 500; font-display: swap; src: url(fonts/barlow-condensed-latin-500.woff2) format("woff2"); unicode-range: U+0020-007E; }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url(fonts/barlow-condensed-latin-600.woff2) format("woff2"); unicode-range: U+0020-007E; }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url(fonts/barlow-condensed-latin-700.woff2) format("woff2"); unicode-range: U+0020-007E; }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 400 500; font-display: swap; src: url(fonts/barlow-semi-condensed-latin-500.woff2) format("woff2"); unicode-range: U+0020-007E; }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 600 800; font-display: swap; src: url(fonts/barlow-semi-condensed-latin-600.woff2) format("woff2"); unicode-range: U+0020-007E; }

:root {
  --bg: #e3e4e6; --panel: #f5f5f6; --panel2: #ebecee; --ink: #15171a; --muted: #636971; --line: #c2c5ca; --line2: #dadce0;
  --accent: #ffe100; --accent-ink: #15171a;      /* signal yellow: fills only, never text on a light ground */
  --mark: #15171a;                               /* accent for text, bars and outlines (yellow on the dark theme) */
  --on-bg: #15171a; --on-ink: #ffe100;           /* a selected control: black block, yellow text */
  --frame: #15171a; --frame-ink: #f5f5f6; --frame-muted: #9299a3; --frame-line: #3a3f47;
  --bad: #d3311f; --good: #1d8348; --sel: #15171a;
  --skill: #2f6fe4; --combo: #12a474; --ult: #ee5a1c; --ult2: #f0a200; --exec: #7a55e0; --chain: #b9bec7;
  --dodge: #f0a200; --hit: #d3311f; --down: #868d97; --hp: #d3311f; --sp: #2f6fe4;
  --shadow: 0 10px 0 -6px rgba(21, 23, 26, .18), 0 18px 40px rgba(21, 23, 26, .22);
  --disp: "Barlow Condensed", "DIN Condensed", "Bahnschrift", "PingFang SC", "Microsoft YaHei", sans-serif;
  --text: "Barlow Semi Condensed", -apple-system, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --haz: repeating-linear-gradient(-45deg, var(--accent) 0 6px, #15171a 6px 12px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1113; --panel: #1a1d21; --panel2: #14171a; --ink: #e9eaec; --muted: #8b929c; --line: #343941; --line2: #262a30;
    --mark: #ffe100; --on-bg: #ffe100; --on-ink: #15171a; --sel: #ffffff; --chain: #3c434e;
    --frame: #07080a; --frame-line: #2c3037;
    --shadow: 0 18px 40px rgba(0, 0, 0, .6);
  }
}
:root[data-theme="dark"] {
  --bg: #0f1113; --panel: #1a1d21; --panel2: #14171a; --ink: #e9eaec; --muted: #8b929c; --line: #343941; --line2: #262a30;
  --mark: #ffe100; --on-bg: #ffe100; --on-ink: #15171a; --sel: #ffffff; --chain: #3c434e;
  --frame: #07080a; --frame-line: #2c3037;
  --shadow: 0 18px 40px rgba(0, 0, 0, .6);
}
* { box-sizing: border-box; }
html, body { margin: 0; color: var(--ink); font: 13px/1.5 var(--text); }
body { background-color: var(--bg); background-image: radial-gradient(circle, color-mix(in srgb, var(--ink) 16%, transparent) .8px, transparent 1.1px); background-size: 20px 20px; }
a { color: var(--ink); text-decoration: none; box-shadow: inset 0 -2px 0 var(--accent); }
a:hover { box-shadow: inset 0 -1.2em 0 var(--accent); color: var(--accent-ink); }
select, input, button, textarea { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 2px; padding: 4px 9px; }
input[type=number] { width: 70px; }
input[type=checkbox] { accent-color: var(--on-bg); }
input[type=range] { accent-color: var(--mark); padding: 0; border: 0; background: transparent; }
select:focus-visible, input:focus-visible, button:focus-visible, textarea:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--mark); outline-offset: 2px; }
button { cursor: pointer; white-space: nowrap; border-color: color-mix(in srgb, var(--ink) 38%, var(--line)); font-weight: 500; }
button:hover { border-color: var(--ink); background: var(--panel2); }
button.primary { background: var(--accent); border-color: #15171a; color: var(--accent-ink); font-weight: 700; }
button.primary:hover { background: #fff04d; }
button.ghost { background: transparent; }
button.on { background: var(--on-bg); border-color: var(--on-bg); color: var(--on-ink); }
button:disabled { opacity: .45; cursor: default; }
.muted { color: var(--muted); } .bad { color: var(--bad); } .good { color: var(--good); }
.row { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin: 5px 0; }
.sp { flex: 1; }
.pill { display: inline-block; padding: 0 6px; border-radius: 0; border: 1px solid var(--line); font-size: 11px; color: var(--muted); background: var(--panel); }
.kbd { font: 600 11px var(--disp); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 2px; padding: 0 4px; color: var(--muted); }
.haz { background: var(--haz); }

/* ---------- frame: left rail */
.shell { display: grid; grid-template-columns: 72px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; background: var(--frame); display: flex; flex-direction: column; align-items: stretch; padding: 0; gap: 0; z-index: 30; }
.side .logo { background: var(--accent); color: #15171a; height: 56px; display: grid; place-content: center; text-align: center; font-weight: 800; font-size: 14px; line-height: 1.1; margin: 0; }
.side .logo small { display: block; font: 600 9px var(--disp); letter-spacing: .16em; margin-top: 3px; }
.side a { position: relative; padding: 13px 0 10px; color: var(--frame-muted); display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; box-shadow: none; border-bottom: 1px solid var(--frame-line); }
.side a svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.side a:hover { background: #22252a; color: var(--frame-ink); box-shadow: none; }
.side a.on { background: #22252a; color: var(--accent); }
.side a.on::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent); }
.side .vert { margin-top: auto; padding: 14px 0; writing-mode: vertical-rl; align-self: center; font: 500 10px var(--disp); letter-spacing: .32em; color: #4b515a; white-space: nowrap; user-select: none; }
.content { min-width: 0; }
/* account entry of the rail (account.js) */
.side .acct { border: 0; border-bottom: 1px solid var(--frame-line); border-radius: 0; background: transparent; color: var(--frame-muted); padding: 13px 2px 10px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; font-weight: 400; }
.side .acct svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.side .acct span { max-width: 66px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .acct:hover { background: #22252a; color: var(--frame-ink); }
.side .acct:focus-visible { outline-color: var(--accent); outline-offset: -3px; }
.side .acct.in { color: var(--frame-ink); }
.side .acct.in svg { color: var(--accent); }

/* ---------- frame: top band */
.top { position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; min-height: 56px; padding: 0 18px 0 0;
  background: var(--frame); color: var(--frame-ink); }
.top .brand { display: flex; align-items: baseline; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: .06em; margin: 0; padding: 0 4px 0 18px; }
.top .brand[data-en]::after { content: attr(data-en); font: 600 12px var(--disp); letter-spacing: .22em; color: var(--frame-muted); }
.top .haz { align-self: stretch; width: 26px; flex: none; clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%); }
.top .muted { color: var(--frame-muted); }
.top a { color: var(--frame-ink); }
.top a:hover { color: #15171a; }
.top button, .top select, .top input { background: transparent; color: var(--frame-ink); border-color: #565c66; }
.top button:hover { border-color: var(--accent); color: var(--accent); background: transparent; }
.teambtn { display: flex; gap: 8px; align-items: center; max-width: 420px; }
.teambtn .names { overflow: hidden; text-overflow: ellipsis; }
.seg { display: inline-flex; border: 1px solid var(--ink); border-radius: 2px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: transparent; padding: 4px 12px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--on-bg); color: var(--on-ink); font-weight: 700; }
.kpi { display: flex; gap: 0; align-items: stretch; margin-left: auto; align-self: stretch; }
.kpi .k { display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; gap: 3px 8px; align-content: center; align-items: baseline; padding: 0 16px; border-left: 1px solid var(--frame-line); }
.kpi .k small { color: var(--frame-muted); font-size: 11px; }
.kpi .k small:first-child { grid-column: 1 / -1; line-height: 1; }
.kpi .k b { font: 700 24px/1 var(--disp); font-variant-numeric: tabular-nums; letter-spacing: .01em; color: var(--frame-ink); }
.kpi .k.main b { color: var(--accent); font-size: 26px; }
.kpi .k #k3 { font: 600 18px/1 var(--disp); color: var(--frame-ink); }
#status { min-width: 80px; }

/* ---------- game images */
img.av { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; vertical-align: middle; background: var(--line2); }
img.av.s { width: 22px; height: 22px; }
img.av.l { width: 56px; height: 56px; }
img.ic { width: 28px; height: 28px; object-fit: contain; vertical-align: middle; border-radius: 0; background: var(--line2); }
img.ic.s { width: 20px; height: 20px; }
img.ic.l { width: 44px; height: 44px; }
.avs { display: inline-flex; gap: 2px; vertical-align: middle; }

/* ---------- panels */
.card { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 0; padding: 12px 14px; margin-bottom: 12px; }
.card::before { content: ""; position: absolute; left: -1px; top: -1px; width: 22px; height: 3px; background: var(--ink); pointer-events: none; }
.card .card { background: var(--panel2); margin-bottom: 8px; }
.card .card::before { width: 10px; }
.card > h3 { margin: 0 0 8px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.card > h3::before { content: ""; flex: none; width: 5px; height: 14px; background: var(--accent); border-left: 3px solid var(--ink); }
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--ink); margin: -12px -14px 12px; padding: 0; }
.tabs button { border: 0; border-radius: 0; background: transparent; padding: 8px 14px; color: var(--muted); border-right: 1px solid var(--line2); }
.tabs button:hover { background: var(--panel2); color: var(--ink); }
.tabs button.on { color: var(--on-ink); background: var(--on-bg); font-weight: 700; }
.tabpane { display: none; } .tabpane.on { display: block; }
.empty { color: var(--muted); padding: 12px 0; text-align: center; }
details summary { cursor: pointer; }

/* ---------- workflow steps: 01 编队 is the formation bar, 02-04 the strip below it */
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin: 12px 18px 0; border: 1px solid var(--line); background: var(--panel); }
@media (max-width: 1100px) { .steps { grid-template-columns: minmax(0, 1fr); } }
.step { position: relative; display: flex; gap: 12px; padding: 10px 14px 12px; min-width: 0; border-left: 1px solid var(--line); border-top: 3px solid transparent; }
.step:first-child { border-left: 0; }
@media (max-width: 1100px) { .step { border-left: 0; border-bottom: 1px solid var(--line); } }
.step .n, .fbar .n1 { flex: none; font: 700 34px/0.9 var(--disp); letter-spacing: -.01em; color: color-mix(in srgb, var(--ink) 28%, transparent); font-variant-numeric: tabular-nums; }
.step.done .n { color: var(--ink); }
.step.next { border-top-color: var(--ink); }
.step.next .n { color: #15171a; background: var(--accent); padding: 3px 5px 1px; margin: -1px 0 auto -5px; }
.step .body { min-width: 0; flex: 1; }
.step .body > b { font-size: 14px; }
.step .sub { color: var(--muted); font-size: 12px; margin: 1px 0 7px; overflow: hidden; text-overflow: ellipsis; }
.step .acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.step .acts > *, .seg, .seg button, .tl-tools .grp > * { flex: none; }
th { white-space: nowrap; }

/* ---------- layout */
.main { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 12px; padding: 12px 18px 40px; }
@media (max-width: 1180px) { .main { grid-template-columns: minmax(0, 1fr); } }
#noTeam { display: flex; align-items: stretch; gap: 14px; text-align: left; padding: 0; margin: 12px 18px; }
#noTeam::after { content: ""; order: -1; flex: none; width: 14px; background: var(--haz); }
#noTeam > span { padding: 14px 14px 14px 0; }

/* ---------- timeline */
.tl-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.tl-tools .grp { display: inline-flex; gap: 4px; align-items: center; padding-right: 8px; border-right: 1px solid var(--line); }
.tl-tools .grp:last-child { border-right: 0; }
.tl-tools .hint { font-size: 11px; color: var(--muted); }
.tl-wrap { position: relative; border: 1px solid var(--ink); border-radius: 0; background: var(--panel2); overflow: hidden; }
.tl-scroll { overflow-x: auto; overflow-y: hidden; }
.tl-labels { position: absolute; left: 0; top: 0; width: 92px; z-index: 3; background: var(--panel); border-right: 1px solid var(--ink); }
.lane-label { position: absolute; left: 0; width: 92px; padding: 4px 6px; font-weight: 700; }
.lane-label.active { box-shadow: inset 4px 0 0 var(--accent), inset 5px 0 0 var(--ink); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.chips { display: flex; gap: 3px; margin-top: 3px; }
.chip { font-size: 10px; font-weight: 700; padding: 0 4px; border-radius: 1px; color: #fff; cursor: grab; user-select: none; line-height: 16px; }
svg text { fill: var(--ink); font-size: 11px; user-select: none; font-family: var(--text); }
svg .clip text { fill: #fff; font-size: 10px; font-weight: 700; pointer-events: none; }
.dragghost { position: fixed; pointer-events: none; z-index: 50; padding: 2px 6px; border-radius: 1px; color: #fff; font-size: 11px; font-weight: 700; opacity: .9; }
#tip { position: fixed; pointer-events: none; z-index: 60; background: var(--panel); border: 1px solid var(--ink); border-top-width: 3px; border-radius: 0; padding: 8px 10px;
  max-width: 380px; font-size: 12px; box-shadow: var(--shadow); display: none; }
#tip .t { font-weight: 700; margin-bottom: 4px; }
#tip .kv { display: grid; grid-template-columns: auto 1fr; gap: 1px 10px; }
#tip .kv span:nth-child(odd) { color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 0; margin-right: 4px; vertical-align: -1px; }
.ctx { position: fixed; z-index: 70; background: var(--panel); border: 1px solid var(--ink); border-radius: 0; box-shadow: var(--shadow); padding: 3px; min-width: 160px; }
.ctx div { padding: 5px 10px; cursor: pointer; display: flex; justify-content: space-between; gap: 16px; }
.ctx div:hover { background: var(--on-bg); color: var(--on-ink); }
.ctx hr { border: 0; border-top: 1px solid var(--line); margin: 3px 0; }

/* ---------- tables */
table { border-collapse: collapse; width: 100%; font-size: 12px; }
th, td { text-align: left; padding: 5px 7px; border-bottom: 1px solid var(--line2); vertical-align: top; }
th { color: var(--muted); font-weight: 500; position: sticky; top: 0; background: var(--panel); z-index: 1; box-shadow: inset 0 -1px 0 var(--ink); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.num { font-size: 13px; }
tr.click { cursor: pointer; } tr.click:hover td { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.scroll { max-height: 340px; overflow: auto; }
.bar { height: 7px; border-radius: 0; background: var(--mark); }
.bar.b2 { background: var(--dodge); margin-top: 2px; }

/* ---------- popovers / modal */
.pop { position: absolute; z-index: 40; background: var(--panel); border: 1px solid var(--ink); border-top-width: 3px; border-radius: 0; box-shadow: var(--shadow); padding: 10px; width: 560px; max-width: calc(100vw - 32px); }
.charchips { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 8px; }
.charchips button { padding: 2px 8px; font-size: 12px; }
.modal-bg { position: fixed; inset: 0; background: rgba(12, 14, 16, .62); z-index: 80; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow: auto; }
.modal { position: relative; background: var(--panel); border: 1px solid var(--ink); border-top: 4px solid var(--ink); border-radius: 0; box-shadow: var(--shadow); width: 1080px; max-width: 100%; padding: 14px 16px; }
.modal::before { content: ""; position: absolute; right: 14px; top: -4px; width: 64px; height: 4px; background: var(--haz); }
.modal.acct-box { width: 400px; }
.acct-box .acct-t { font-size: 16px; }
.acct-box .acct-name { font: 700 28px/1.1 var(--disp); margin: 12px 0 2px; overflow-wrap: anywhere; }
.acct-box .seg { margin-top: 8px; }
.acct-box form { display: grid; gap: 10px; margin: 12px 0 4px; }
.acct-box label { display: grid; gap: 3px; font-size: 12px; color: var(--muted); }
.acct-box label input { font-size: 14px; padding: 7px 9px; }
.acct-box .msg { flex: 1; font-size: 12px; }
.acct-box .acct-code { display: flex; gap: 6px; }
.acct-box .acct-code input { flex: 1; min-width: 0; }
.acct-box .acct-code button { color: var(--ink); }
.acct-box details form { margin-top: 8px; }
.acct-box details { margin-top: 10px; border-top: 1px solid var(--line2); padding-top: 8px; }
.acct-box summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.acct-box p { margin: 8px 0 4px; font-size: 12px; }
.members { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 900px) { .members { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.member { border: 1px solid var(--line); border-radius: 0; padding: 8px; }
.member label { display: block; font-size: 11px; color: var(--muted); margin-top: 6px; }
.member select { width: 100%; }
.suits { font-size: 11px; margin-top: 6px; }
.jobs .job { border: 1px solid var(--line); border-left: 3px solid var(--ink); border-radius: 0; padding: 6px 8px; margin: 6px 0; }
.prog { height: 4px; background: var(--line); border-radius: 0; overflow: hidden; margin-top: 4px; }
.prog > div { height: 100%; background: var(--mark); }

/* ---------- formation */
.modal.formation { width: 1180px; }
.fslots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 10px 0; }
@media (max-width: 900px) { .fslots { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.fslot { position: relative; border: 1px solid var(--line); border-radius: 0; overflow: hidden; background: var(--panel2); }
.fslot.on { border-color: var(--ink); box-shadow: 0 0 0 2px var(--accent), 0 0 0 3px var(--ink); }
.fport { position: relative; aspect-ratio: 900 / 352; background: linear-gradient(135deg, #343a44, #15171a); cursor: pointer; overflow: hidden; }
.fport img { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }
.fempty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 14px; }
.fmain { position: absolute; left: 0; top: 0; background: var(--accent); color: #15171a; font-size: 11px; font-weight: 800; padding: 2px 9px 2px 8px; border-radius: 0; clip-path: polygon(0 0, 100% 0, calc(100% - 7px) 100%, 0 100%); padding-right: 14px; }
.fmain.idx { background: #15171a; color: #f5f5f6; font: 700 13px/1.5 var(--disp); }
.fx { position: absolute; right: 6px; top: 6px; width: 22px; height: 22px; border-radius: 0; background: rgba(0, 0, 0, .55); color: #fff; display: grid; place-items: center; cursor: pointer; }
.fx:hover { background: var(--bad); }
.fname { padding: 6px 10px 0; }
.fweap { display: flex; gap: 8px; align-items: center; padding: 6px 10px; cursor: pointer; }
.fweap:hover, .fg:hover { background: var(--line2); }
.fgear { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 0 8px; }
.fg { text-align: center; cursor: pointer; border-radius: 0; padding: 4px 2px; }
.fgn { font-size: 10px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fslot .suits { padding: 4px 10px 8px; }
.fe { display: inline-grid; place-items: center; color: var(--muted); font-size: 12px; border: 1px dashed var(--line); }
.dis { opacity: .4; pointer-events: none; }
.fpick { border-top: 1px solid var(--line); padding-top: 8px; max-height: 46vh; overflow: auto; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; margin: 6px 0; }
.fcard { display: flex; gap: 8px; align-items: center; border: 1px solid var(--line); border-radius: 0; padding: 6px 8px; cursor: pointer; font-size: 12px; background: var(--panel); }
.fcard:hover { border-color: var(--ink); }
.fcard.on { border-color: var(--ink); box-shadow: inset 4px 0 0 var(--accent), inset 5px 0 0 var(--ink); background: color-mix(in srgb, var(--accent) 14%, var(--panel)); }
.fcard.used { opacity: .55; }
.fcard.s { font-size: 11px; }
.fcard.wide { margin: 4px 0; }
.fgroup { margin-bottom: 4px; }
.stars { color: #f0a200; font-size: 11px; letter-spacing: 1px; }

/* ---------- formation bar on the page */
.fbar { margin: 12px 18px 0; padding: 10px 14px 12px; }
.fbar.next { border-color: var(--ink); }
.fbar.next::before { width: 100%; background: var(--haz); height: 4px; }
.fbar > .row { flex-wrap: wrap; gap: 6px; margin: 0; align-items: center; }
.fbar > .row > * { flex: none; }
.fbar > .row > b { font-size: 14px; }
.fbar > .row > #st1 { flex: 1 1 200px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fbar .n1 { color: var(--ink); margin-right: 4px; }
.fbar.next .n1 { color: #15171a; background: var(--accent); padding: 3px 5px 1px; }
.fbar .fslots { margin: 10px 0 0; }
.fslot.empty { display: grid; place-items: center; align-content: center; gap: 8px; min-height: 250px; border-style: dashed; border-color: color-mix(in srgb, var(--ink) 40%, var(--line)); cursor: pointer;
  background: repeating-linear-gradient(-45deg, transparent 0 9px, color-mix(in srgb, var(--ink) 5%, transparent) 9px 10px); }
.fslot.empty:hover { border-color: var(--ink); border-style: solid; }
.fslot.empty:hover .fplus { background: var(--accent); color: #15171a; border-color: #15171a; }
.fplus { width: 52px; height: 52px; border-radius: 0; display: grid; place-items: center; font-size: 28px; color: var(--muted); border: 1px solid var(--muted); background: var(--panel); }
.fcap { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 10px 6px; color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, .78)); pointer-events: none; }
.fcap b { font-size: 16px; letter-spacing: .04em; }
.fcap .fsub { font-size: 11px; opacity: .85; }
.frow { display: flex; align-items: center; gap: 6px; padding: 6px 10px 0; }
.fcompact { display: none; cursor: pointer; }
.fwn { min-width: 0; }
.fwn > div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.fslot select { padding: 1px 4px; }
.fbar.small .fport, .fbar.small .fgear, .fbar.small .suits { display: none; }
.fbar.small .fcompact { display: flex; }
.fbar.small .fslot.empty { min-height: 84px; }
.fbar.small .fplus { width: 30px; height: 30px; font-size: 18px; }
/* character picker: portrait cards */
.fgrid.chars { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.fcard.pc { position: relative; display: block; padding: 0; overflow: hidden; }
.fcard.pc .pcimg { width: 100%; aspect-ratio: 900 / 352; object-fit: cover; object-position: center; display: block; background: linear-gradient(135deg, #343a44, #15171a); }
.fcard.pc .pcn { padding: 5px 8px 6px; }
.fcard.pc .pcat { position: absolute; top: 6px; right: 6px; background: var(--panel); }
.modal.formation .fpick { border-top: 0; padding-top: 0; max-height: 74vh; }

/* ---------- contract tags in the side panel */
.cctags { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 8px 6px; margin: 4px 0 8px; }
.cctags > div { display: grid; gap: 2px; align-content: start; padding-top: 3px; border-top: 2px solid var(--line); }
.cctags button { display: flex; justify-content: space-between; align-items: baseline; gap: 4px; width: 100%; padding: 2px 6px; font-size: 11px; text-align: left; }
.cctags button span { overflow: hidden; text-overflow: ellipsis; }
.cctags button b { font: 700 13px var(--disp); color: var(--muted); }
.cctags button.on b { color: inherit; }

/* ---------- stage picker: categories | stage rows | details */
.modal-bg.stgbg { padding: 28px 16px; overflow: hidden; }
.modal.stg { width: 1340px; padding: 0; display: flex; flex-direction: column; height: calc(100vh - 56px); max-height: 900px; }
.stg-head { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--ink); }
.stg-head b { font-size: 18px; letter-spacing: .06em; }
.stg-head .en { font: 600 12px var(--disp); letter-spacing: .22em; color: var(--muted); }
.stg-head input { width: 260px; }
.stg-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 164px minmax(340px, 1fr) minmax(380px, 480px); }
.stg-cats { border-right: 1px solid var(--ink); overflow: auto; background: var(--panel2); }
.stg-cats button { display: flex; width: 100%; justify-content: space-between; align-items: baseline; gap: 8px; text-align: left; border: 0; border-bottom: 1px solid var(--line2); border-radius: 0; background: transparent; padding: 9px 12px 9px 16px; }
.stg-cats button small { font: 600 13px var(--disp); color: var(--muted); }
.stg-cats button:hover { background: var(--panel); }
.stg-cats button.on { background: var(--on-bg); color: var(--on-ink); font-weight: 700; box-shadow: inset 4px 0 0 var(--accent); }
.stg-cats button.on small { color: inherit; }
.stg-list { overflow: auto; border-right: 1px solid var(--ink); }
.stg-series { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 8px; padding: 7px 14px 6px; font-weight: 700; background: var(--panel); border-bottom: 1px solid var(--line); }
.stg-series::before { content: ""; width: 5px; height: 13px; background: var(--accent); border-left: 3px solid var(--ink); }
.stg-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; min-height: 40px; padding: 5px 12px 5px 16px; border-bottom: 1px solid var(--line2); cursor: pointer; }
.stg-row:hover { background: var(--panel2); }
.stg-row.on { background: color-mix(in srgb, var(--accent) 20%, var(--panel)); box-shadow: inset 4px 0 0 var(--accent), inset 5px 0 0 var(--ink); }
.stg-row .nm { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stg-row .nm small { margin-left: 8px; font-weight: 400; font-size: 12px; color: var(--muted); }
.stg-row .eic { display: flex; gap: 2px; }
.stg-row .eic img { width: 24px; height: 24px; object-fit: contain; background: var(--line2); }
.stg-row .vs { display: flex; gap: 4px; justify-content: flex-end; }
.stg-row .vs button { min-width: 62px; padding: 2px 8px; font-size: 12px; background: var(--panel); }
.stg-row .vs button.on { background: var(--on-bg); color: var(--on-ink); border-color: var(--on-bg); font-weight: 700; }
.stg-detail { display: flex; flex-direction: column; min-height: 0; background: var(--panel2); }
.stg-dscroll { flex: 1; overflow: auto; padding: 14px 16px 18px; }
.stg-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.stg-title b { font-size: 20px; letter-spacing: .04em; }
.stg-title .lv { text-align: right; font: 700 36px/0.9 var(--disp); }
.stg-title .lv small { display: block; font: 400 11px/1.2 var(--text); color: var(--muted); margin-bottom: 4px; }
.stg-feat { white-space: pre-wrap; margin-top: 8px; padding: 8px 10px; background: var(--panel); border-left: 3px solid var(--ink); font-size: 12px; }
.stg-note { margin-top: 8px; padding: 8px 10px 8px 22px; font-size: 12px; background: linear-gradient(90deg, var(--accent) 0 6px, transparent 6px), var(--panel); border: 1px solid var(--line); }
.stg-desc { white-space: pre-wrap; margin-top: 14px; font-size: 12px; color: var(--muted); }
.stg-sec { display: flex; align-items: baseline; gap: 10px; margin: 16px 0 6px; font-weight: 700; }
.stg-sec .muted { font-weight: 400; font-size: 12px; }
.stg-detail table { background: var(--panel); }
.stg-detail th { background: var(--panel); }
.wv { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 6px; align-items: start; padding: 5px 8px; background: var(--panel); border-bottom: 1px solid var(--line2); }
.wv > b { font: 700 20px/1.2 var(--disp); }
.wv > div { display: flex; flex-wrap: wrap; gap: 3px 14px; }
.wv span { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; }
.wv img { width: 22px; height: 22px; object-fit: contain; background: var(--line2); }
.wv i { font-style: normal; font-weight: 700; }
.stg-dfoot { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--ink); background: var(--panel); }
.stg-dfoot button.primary { padding: 8px 26px; font-size: 14px; }
.stg-dfoot .muted { font-size: 12px; }
@media (max-width: 1000px) {
  .modal-bg.stgbg { overflow: auto; }
  .modal.stg { height: auto; max-height: none; }
  .stg-body { grid-template-columns: minmax(0, 1fr); }
  .stg-cats { display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--ink); }
  .stg-cats button { width: auto; white-space: nowrap; }
  .stg-list { max-height: 44vh; border-right: 0; border-bottom: 1px solid var(--ink); }
}

@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; flex-direction: row; }
  .side .logo { height: auto; padding: 8px 12px; }
  .side a { flex-direction: row; padding: 8px 12px; border-bottom: 0; }
  .side .acct { flex-direction: row; padding: 8px 12px; border-bottom: 0; margin-left: auto; }
  .side a.on::before { top: auto; right: 0; width: auto; height: 3px; }
  .side .vert { display: none; }
  .top { position: static; padding-bottom: 6px; }
  .kpi { margin-left: 0; flex-wrap: wrap; }
}
@media (prefers-reduced-motion: no-preference) {
  button, .fcard, .stg-card, .side a { transition: background-color .12s, border-color .12s, color .12s; }
}
