/* gate-conducts.css (2026-10-23): the eleven 達成項目 at a normal dungeon entrance (src/ui/gateConducts.js).
   Loads after instrument-ui.css. Art: assets/ui/conduct-gate-2026-10-23 (manifest.json there is the source of the sizes):
   icons 96x96 RGBA per item / state / theme (lit = stamp with a check notch, dim = unlit outline), a 160x48 soft lit plate
   (slice 8 20 8 20), and the GB sheet cg-gb-glyphs.png (224x16, 14 cells of 16x16: lit x7 then dim x7, black on alpha).
   Rules of this sheet: no heavy frame or selection box, no card; the strip is display only (nothing in it takes focus),
   and the entrance / carry-in panels keep 入る / 戻る outside the one scrolling region (.gate-body). */

/* ---------- 1. shared strip markup (every skin) ---------- */
.gate-conducts { min-width: 0; margin: 6px 0 0; }
.gate-conducts-title { font-size: max(10px, var(--fs-note, 11px)); line-height: 1.2; letter-spacing: .08em; margin: 0 0 2px; color: var(--ob-ink-2, inherit); }
.gate-conducts-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px 6px; min-width: 0; }
.gate-conduct { position: relative; min-width: 0; margin: 0; }
.gate-conduct > b { font-weight: 700; }
.gate-conduct > small { display: block; }
/* the state word is always in the page for readers and assistive tech; only GB shows it */
.gate-conduct-state { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.gate-conducts-help { margin: 3px 0 0; }
.gate-conducts-detail { margin: 2px 0 0; font-size: max(10px, var(--fs-note, 11px)); line-height: 1.3; }
.gate-conducts-detail dt { font-weight: 700; margin: 3px 0 0; }
.gate-conducts-detail dd { margin: 0; overflow-wrap: anywhere; }
/* the village gate inspect keeps the same strip inside its block */
.inspect-gate > .gate-conducts { margin-top: 4px; }

/* ---------- 2. PS1 (liz, elvi; dark / light / console): bitmap icons ---------- */
html:not([data-skin="gb"]) {
  --cg-icon: 28px;
  --cg-plate-liz: url("../../../assets/ui/conduct-gate-2026-10-23/cg-cell-lit-liz.webp");
  --cg-plate-elvi: url("../../../assets/ui/conduct-gate-2026-10-23/cg-cell-lit-elvi.webp");
  --cg-plate: var(--cg-plate-liz);
}
html[data-protagonist="elvi"]:not([data-skin="gb"]), html[data-ui-theme="console"]:not([data-skin="gb"]) { --cg-plate: var(--cg-plate-elvi); }
@media (orientation: landscape) and (min-width: 900px) { html:not([data-skin="gb"]) { --cg-icon: 32px; } }

html:not([data-skin="gb"]) body .gate-conducts-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (orientation: landscape) and (min-width: 900px) {
  html:not([data-skin="gb"]) body .gate-conducts-list { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 4px; }
}
html:not([data-skin="gb"]) body .gate-conduct {
  display: grid; grid-template-columns: var(--cg-icon) minmax(0, 1fr); grid-template-rows: auto auto; align-content: center; column-gap: 5px;
  min-height: calc(var(--cg-icon) + 4px); padding: 2px 4px; isolation: isolate;
}
html:not([data-skin="gb"]) body .gate-conduct-icon {
  grid-row: 1 / span 2; align-self: center; width: var(--cg-icon); height: var(--cg-icon);
  background: var(--cg-img) center / contain no-repeat;
}
html:not([data-skin="gb"]) body .gate-conduct > b { align-self: end; font-size: max(11px, var(--fs-body, 13px)); line-height: 1.15; overflow-wrap: anywhere; }
html:not([data-skin="gb"]) body .gate-conduct > small { align-self: start; font-size: max(10px, var(--fs-note, 11px)); line-height: 1.15; overflow-wrap: anywhere; color: var(--ob-ink-2, inherit); }
/* the lit plate: a soft glow behind an achieved item; a pseudo layer so it takes no layout space */
html:not([data-skin="gb"]) body .gate-conduct[data-achieved="true"]::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; box-sizing: border-box;
  border: solid transparent; border-width: 8px 20px; border-image: var(--cg-plate) 8 20 8 20 fill / 8px 20px stretch;
}
/* the plate is a glow; stretched behind text it clouds it, so it is faint everywhere and absent in the green console look */
html:not([data-skin="gb"]) body .gate-conduct[data-achieved="true"]::before { opacity: .5; }
html[data-ui-theme="console"] body .gate-conduct[data-achieved="true"]::before { display: none; }
/* achieved and pending differ by more than the icon: an achieved name is full ink and ends in a check, a pending one is the second ink (the state word stays in the page for readers) */
html:not([data-skin="gb"]) body .gate-conduct[data-achieved="true"] > b { color: var(--ob-ink, inherit); }
html:not([data-skin="gb"]) body .gate-conduct[data-achieved="true"] > b::after { content: " ✓"; content: " ✓" / ""; font-weight: 700; }
html:not([data-skin="gb"]) body .gate-conduct[data-achieved="false"] > b { color: var(--ob-ink-2, inherit); font-weight: 400; }

/* icon files: liz art by default, elvi art for her and for the console look */
html .gate-conduct[data-icon="carry"][data-achieved="true"] { --cg-img: url("../../../assets/ui/conduct-gate-2026-10-23/cg-icon-carry-lit-liz.webp"); }
html .gate-conduct[data-icon="naked"][data-achieved="true"] { --cg-img: url("../../../assets/ui/conduct-gate-2026-10-23/cg-icon-naked-lit-liz.webp"); }
html .gate-conduct[data-icon="barbarian"][data-achieved="true"] { --cg-img: url("../../../assets/ui/conduct-gate-2026-10-23/cg-icon-barbarian-lit-liz.webp"); }
html .gate-conduct[data-icon="mono"][data-achieved="true"] { --cg-img: url("../../../assets/ui/conduct-gate-2026-10-23/cg-icon-mono-lit-liz.webp"); }
html .gate-conduct[data-icon="efficient"][data-achieved="true"] { --cg-img: url("../../../assets/ui/conduct-gate-2026-10-23/cg-icon-efficient-lit-liz.webp"); }
html .gate-conduct[data-icon="flee"][data-achieved="true"] { --cg-img: url("../../../assets/ui/conduct-gate-2026-10-23/cg-icon-flee-lit-liz.webp"); }
html .gate-conduct[data-icon="frugal"][data-achieved="true"] { --cg-img: url("../../../assets/ui/conduct-gate-2026-10-23/cg-icon-frugal-lit-liz.webp"); }
html .gate-conduct[data-icon="carry"][data-achieved="false"] { --cg-img: url("../../../assets/ui/conduct-gate-2026-10-23/cg-icon-carry-dim-liz.webp"); }
html .gate-conduct[data-icon="naked"][data-achieved="false"] { --cg-img: url("../../../assets/ui/conduct-gate-2026-10-23/cg-icon-naked-dim-liz.webp"); }
html .gate-conduct[data-icon="barbarian"][data-achieved="false"] { --cg-img: url("../../../assets/ui/conduct-gate-2026-10-23/cg-icon-barbarian-dim-liz.webp"); }
html .gate-conduct[data-icon="mono"][data-achieved="false"] { --cg-img: url("../../../assets/ui/conduct-gate-2026-10-23/cg-icon-mono-dim-liz.webp"); }
html .gate-conduct[data-icon="efficient"][data-achieved="false"] { --cg-img: url("../../../assets/ui/conduct-gate-2026-10-23/cg-icon-efficient-dim-liz.webp"); }
html .gate-conduct[data-icon="flee"][data-achieved="false"] { --cg-img: url("../../../assets/ui/conduct-gate-2026-10-23/cg-icon-flee-dim-liz.webp"); }
html .gate-conduct[data-icon="frugal"][data-achieved="false"] { --cg-img: url("../../../assets/ui/conduct-gate-2026-10-23/cg-icon-frugal-dim-liz.webp"); }
:is(html[data-protagonist="elvi"], html[data-ui-theme="console"]) .gate-conduct[data-icon="carry"][data-achieved="true"] { --cg-img: url("../../../assets/ui/conduct-gate-2026-10-23/cg-icon-carry-lit-elvi.webp"); }
:is(html[data-protagonist="elvi"], html[data-ui-theme="console"]) .gate-conduct[data-icon="naked"][data-achieved="true"] { --cg-img: url("../../../assets/ui/conduct-gate-2026-10-23/cg-icon-naked-lit-elvi.webp"); }
:is(html[data-protagonist="elvi"], html[data-ui-theme="console"]) .gate-conduct[data-icon="barbarian"][data-achieved="true"] { --cg-img: url("../../../assets/ui/conduct-gate-2026-10-23/cg-icon-barbarian-lit-elvi.webp"); }
:is(html[data-protagonist="elvi"], html[data-ui-theme="console"]) .gate-conduct[data-icon="mono"][data-achieved="true"] { --cg-img: url("../../../assets/ui/conduct-gate-2026-10-23/cg-icon-mono-lit-elvi.webp"); }
:is(html[data-protagonist="elvi"], html[data-ui-theme="console"]) .gate-conduct[data-icon="efficient"][data-achieved="true"] { --cg-img: url("../../../assets/ui/conduct-gate-2026-10-23/cg-icon-efficient-lit-elvi.webp"); }
:is(html[data-protagonist="elvi"], html[data-ui-theme="console"]) .gate-conduct[data-icon="flee"][data-achieved="true"] { --cg-img: url("../../../assets/ui/conduct-gate-2026-10-23/cg-icon-flee-lit-elvi.webp"); }
:is(html[data-protagonist="elvi"], html[data-ui-theme="console"]) .gate-conduct[data-icon="frugal"][data-achieved="true"] { --cg-img: url("../../../assets/ui/conduct-gate-2026-10-23/cg-icon-frugal-lit-elvi.webp"); }
:is(html[data-protagonist="elvi"], html[data-ui-theme="console"]) .gate-conduct[data-icon="carry"][data-achieved="false"] { --cg-img: url("../../../assets/ui/conduct-gate-2026-10-23/cg-icon-carry-dim-elvi.webp"); }
:is(html[data-protagonist="elvi"], html[data-ui-theme="console"]) .gate-conduct[data-icon="naked"][data-achieved="false"] { --cg-img: url("../../../assets/ui/conduct-gate-2026-10-23/cg-icon-naked-dim-elvi.webp"); }
:is(html[data-protagonist="elvi"], html[data-ui-theme="console"]) .gate-conduct[data-icon="barbarian"][data-achieved="false"] { --cg-img: url("../../../assets/ui/conduct-gate-2026-10-23/cg-icon-barbarian-dim-elvi.webp"); }
:is(html[data-protagonist="elvi"], html[data-ui-theme="console"]) .gate-conduct[data-icon="mono"][data-achieved="false"] { --cg-img: url("../../../assets/ui/conduct-gate-2026-10-23/cg-icon-mono-dim-elvi.webp"); }
:is(html[data-protagonist="elvi"], html[data-ui-theme="console"]) .gate-conduct[data-icon="efficient"][data-achieved="false"] { --cg-img: url("../../../assets/ui/conduct-gate-2026-10-23/cg-icon-efficient-dim-elvi.webp"); }
:is(html[data-protagonist="elvi"], html[data-ui-theme="console"]) .gate-conduct[data-icon="flee"][data-achieved="false"] { --cg-img: url("../../../assets/ui/conduct-gate-2026-10-23/cg-icon-flee-dim-elvi.webp"); }
:is(html[data-protagonist="elvi"], html[data-ui-theme="console"]) .gate-conduct[data-icon="frugal"][data-achieved="false"] { --cg-img: url("../../../assets/ui/conduct-gate-2026-10-23/cg-icon-frugal-dim-elvi.webp"); }

/* ---------- 3. entrance / carry-in panels (PS1 layouts): 入る / 戻る never scroll away ---------- */
/* the panel is a column: heading, the one scrolling .gate-body, then the action row (and 戻る) outside the scroll */
:root:root:root:not([data-skin="gb"]) body #productFlowPanel:is(.product-flow-gate-panel, .product-flow-carry-panel) {
  display: flex; flex-direction: column; overflow: hidden; min-height: 0;
}
:root:root:root:not([data-skin="gb"]) body #productFlowPanel:is(.product-flow-gate-panel, .product-flow-carry-panel) > :not(.gate-body) { flex: none; }
:root:root:root:not([data-skin="gb"]) body #productFlowPanel:is(.product-flow-gate-panel, .product-flow-carry-panel) > .gate-body {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-right: 2px;
}
/* one scroll region: the candidate list no longer scrolls on its own inside it */
:root:root:root:not([data-skin="gb"]) body #productFlowPanel.product-flow-carry-panel .gate-body .carry-in-list { max-height: none; overflow: visible; }
:root:root:root:not([data-skin="gb"]) body #productFlowPanel.product-flow-carry-panel .gate-body .carry-in-list,
:root:root:root:not([data-skin="gb"]) body #productFlowPanel.product-flow-carry-panel .gate-body .flow-selected-item { margin-top: 6px; }
:root:root:root:not([data-skin="gb"]) body #productFlowPanel:is(.product-flow-gate-panel, .product-flow-carry-panel) > .product-flow-actions { margin-block: 6px 0; }
:root:root:root:not([data-skin="gb"]) body #productFlowPanel.product-flow-carry-panel > .product-flow-back { margin-top: 2px; }

/* ---------- 4. GB: name + state, one flat ink; glyphs are 16x16 masks coloured by the GB tones ---------- */
html[data-skin="gb"] .gate-conducts { margin: calc(var(--gb-dot, 2px) * 2) 0 0; }
html[data-skin="gb"] .gate-conducts-title { color: var(--gb-2); letter-spacing: 0; }
html[data-skin="gb"] .gate-conducts-list { grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); gap: 0 calc(var(--gb-dot, 2px) * 3); }
html[data-skin="gb"] .gate-conduct { display: flex; align-items: center; gap: calc(var(--gb-dot, 2px) * 2); min-height: 18px; padding: 1px 0; }
html[data-skin="gb"] .gate-conduct > small { display: none; }
html[data-skin="gb"] .gate-conduct > b { font-weight: 400; flex: none; }
/* GB shows the state as a word (the only skin where it is visible): 済 reads as the inverted name bar of the other GB conduct rows */
html[data-skin="gb"] .gate-conduct-state { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip-path: none; color: var(--gb-2); min-width: 0; }
html[data-skin="gb"] .gate-conduct[data-achieved="true"] > b { background: var(--gb-3); color: var(--gb-0); padding: 0 calc(var(--gb-dot, 2px) * 2); }
html[data-skin="gb"] .gate-conduct[data-achieved="true"] .gate-conduct-state { color: var(--gb-3); }
html[data-skin="gb"] .gate-conduct-icon {
  flex: none; width: 16px; height: 16px; background: var(--gb-2);
  -webkit-mask: url("../../../assets/ui/conduct-gate-2026-10-23/cg-gb-glyphs.png") no-repeat; mask: url("../../../assets/ui/conduct-gate-2026-10-23/cg-gb-glyphs.png") no-repeat;
  -webkit-mask-size: 224px 16px; mask-size: 224px 16px; -webkit-mask-position: calc((var(--gi, 0) + var(--gs, 7)) * -16px) 0; mask-position: calc((var(--gi, 0) + var(--gs, 7)) * -16px) 0;
  image-rendering: pixelated;
}
html[data-skin="gb"] .gate-conduct[data-achieved="true"] .gate-conduct-icon { --gs: 0; background: var(--gb-3); }
html[data-skin="gb"] .gate-conduct[data-achieved="false"] .gate-conduct-icon { --gs: 7; }
html[data-skin="gb"] .gate-conduct[data-icon="carry"] .gate-conduct-icon { --gi: 0; }
html[data-skin="gb"] .gate-conduct[data-icon="naked"] .gate-conduct-icon { --gi: 1; }
html[data-skin="gb"] .gate-conduct[data-icon="barbarian"] .gate-conduct-icon { --gi: 2; }
html[data-skin="gb"] .gate-conduct[data-icon="mono"] .gate-conduct-icon { --gi: 3; }
html[data-skin="gb"] .gate-conduct[data-icon="efficient"] .gate-conduct-icon { --gi: 4; }
html[data-skin="gb"] .gate-conduct[data-icon="flee"] .gate-conduct-icon { --gi: 5; }
html[data-skin="gb"] .gate-conduct[data-icon="frugal"] .gate-conduct-icon { --gi: 6; }

/* ---------- 4. 階層ごとの特殊ルール (carry-in panel) ---------- */
.carry-in-floor-rules { margin: 0 0 8px; }
.carry-in-floor-rules h3 { margin: 0 0 4px; font-size: 0.95em; }
.carry-in-floor-rules ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.carry-in-floor-rules li { display: grid; gap: 2px; font-size: 0.9em; line-height: 1.45; }
.carry-in-floor-rules li > span { opacity: 0.85; }
