/* Shared look for every page ("Item-first" design, approved mockup: mockups/direction-g.html).
   Teal on dark grey. Fonts: Figtree (UI, item names), JetBrains Mono (search strings, pasted text).
   All colours are tokens in :root. Sections:
     base (incl. in-game icons) · shell (top tool bar, launcher) · form · item preview · search + check column · tooltip · narrow screens */

:root {
  --bg: #131417;
  --panel: #1c1d21;
  --raise: #2b2d33;
  --raise-hi: #34363d;
  --field: #121316;
  --edge: #2f3137;
  --edge-hi: #43464e;
  --ink: #d8d9de;
  --ink-2: #a0a3ac;
  --ink-3: #777a84;
  --accent: #5fc3cf;
  --accent-hi: #74d0db;
  --accent-ink: #0e2226;
  --accent-bg: #1f3438;
  --pass: #86c77a;
  --pass-ink: #12210f;
  --pass-bg: #1f2e1d;
  --hit-bg: #2b4a36;
  --warn: #d9b26a;
  --fail: #e07467;
  --magic: #a4aefc;
  --magic-2: #b9c0ff;
  --magic-dim: #5d6290;
  --card: #17181c;
  --card-edge: #4a4e58;
  --card-line: #2a2c33;
  --need-edge: #3c5d62;
  --need-bg: #1a2427;
  --note-bg: #1e2128;
  --dots: #22242a;
  --tip-bg: #2f3138;
  --tip-edge: #4a4d56;
  --ui: "Figtree", "Segoe UI", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --r: 8px;
  color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 14px/1.45 var(--ui); -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; color: inherit; }
p, h1, h2, h3, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
kbd { font: 500 11.5px/1 var(--mono); color: var(--ink); background: var(--raise); border: 1px solid var(--edge-hi); border-bottom-width: 2px; border-radius: 4px; padding: 2px 5px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.info { width: 20px; height: 20px; padding: 0; border: 0; background: none; color: var(--ink-3); cursor: help; display: inline-grid; place-items: center; border-radius: 50%; vertical-align: middle; }
.info:hover, .info:focus-visible { color: var(--accent); }
.info svg { width: 16px; height: 16px; }
.dots { background-image: radial-gradient(circle at 1px 1px, var(--dots) 1px, transparent 1.4px); background-size: 22px 22px; }
/* in-game icons from assets/game-icons.js (served 78px per inventory cell, shown smaller; width/height come from the tag).
   .off = the SVG drawn when the image cannot load; :where() keeps it easy for a tool to restyle. */
.game-icon { display: inline-block; flex: none; vertical-align: middle; object-fit: contain; image-rendering: auto; }
.game-icon.gi-flask { object-fit: cover; object-position: 0 0; }   /* flask art = 3 pictures side by side: show the first */
/* img.game-icon.i = an svg[data-art] line icon turned into game art: a bit larger than the icon it replaces,
   with negative margins so the text does not move */
img.game-icon.i { width: 22px; height: 22px; margin: -3px -1px -3px -2px; }
.tile .ic img.game-icon.i { width: 32px; height: 32px; margin: 0; }
.fh h1 img.game-icon.i { width: 28px; height: 28px; margin: -4px -2px -4px -3px; }
.card-opt .ic img.game-icon.i { width: 30px; height: 30px; margin: 0; }
.bh img.game-icon.i { width: 26px; height: 26px; margin: -3px -1px -3px -2px; }
.qs .ic img.game-icon.i { width: 20px; height: 20px; margin: 0; }
:where(svg.game-icon.off) { fill: none; stroke: var(--ink-3); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- shell: top tool bar ---------- */
.app { display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100vh; }
.top { display: flex; align-items: center; gap: 22px; padding: 0 18px; height: 54px; border-bottom: 1px solid var(--edge); min-width: 0; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 750; font-size: 15px; white-space: nowrap; }
.brand svg { color: var(--accent); width: 21px; height: 21px; }
.tools { display: flex; gap: 4px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tools::-webkit-scrollbar { display: none; }
.top.compact .tool:not([aria-current]) { padding: 7px 9px; }
.top.compact .tool:not([aria-current]) .tl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tool { display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; color: var(--ink-3); white-space: nowrap; font-weight: 600; font-size: 13.5px; }
.tool svg { width: 17px; height: 17px; }
.tool small { font-size: 11.5px; font-weight: 500; color: var(--ink-3); }
a.tool:hover { color: var(--ink); }
.tool[aria-current] { background: var(--accent-bg); color: var(--ink); }
.tool[aria-current] svg { color: var(--accent); }
.tool.soon { cursor: default; }
.legal { margin-top: auto; padding: 11px 18px 13px; font-size: 11.5px; line-height: 1.4; color: var(--ink-3); border-top: 1px solid var(--edge); }
.legal b { color: var(--ink-2); font-weight: 650; }

/* ---------- shell: launcher (home) ---------- */
.launch { min-height: 100vh; display: flex; flex-direction: column; }
.hub { flex: 1; padding: 22px 18px 28px; }
.hub-h { font-size: 15px; font-weight: 750; display: flex; align-items: center; gap: 7px; margin-bottom: 12px; }
.hub-h svg { width: 18px; height: 18px; color: var(--accent); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 8px; max-width: 1100px; }
.tile { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 1px 12px; align-items: center; height: 100%; padding: 12px 14px; border: 1px solid var(--edge); border-radius: 10px; background: var(--panel); }
.tile .ic { grid-row: span 2; width: 40px; height: 40px; border-radius: 9px; display: grid; place-items: center; background: var(--raise); color: var(--ink-2); }
.tile .ic svg { width: 23px; height: 23px; }
.tile b { font-weight: 700; font-size: 14.5px; min-width: 0; }
.tile .t { grid-column: 2 / -1; font-size: 12.5px; color: var(--ink-2); line-height: 1.35; }
.tile .state { font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--raise); color: var(--ink-3); }
a.tile .ic { background: var(--accent-bg); color: var(--accent); }
a.tile .state { background: var(--accent-bg); color: var(--accent); }
a.tile:hover { border-color: var(--accent); }
.tile.soon { background: transparent; border-style: dashed; }
.tile.soon b, .tile.soon .t { color: var(--ink-3); }

/* ---------- workbench: form · preview · output ---------- */
.work { display: grid; grid-template-columns: 350px minmax(0, 1fr) 420px; min-height: 0; }

.form { background: var(--panel); border-right: 1px solid var(--edge); min-height: 0; overflow: auto; padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 15px; }
.fh h1 { font-size: 17px; font-weight: 750; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.fh h1 svg { width: 22px; height: 22px; color: var(--accent); }
.fh p { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.q { display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 650; margin-bottom: 6px; flex-wrap: wrap; }
.q .hint { font-weight: 400; color: var(--ink-3); font-size: 12.5px; flex-basis: 100%; margin-top: -3px; }
.in { width: 100%; background: var(--field); border: 1px solid var(--edge); border-radius: var(--r); padding: 9px 11px; font: 500 14.5px/1.35 var(--ui); color: var(--ink); }
.in::placeholder { color: var(--ink-3); font-weight: 400; }
textarea.in { resize: none; }
.in:hover { border-color: var(--edge-hi); }
.in:focus { outline: none; border-color: var(--accent); }

/* choice cards (radio) */
.cards { display: grid; gap: 6px; }
.card-opt { position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 1px 10px; padding: 9px 11px; border: 1px solid var(--edge); border-radius: var(--r); background: var(--raise); cursor: pointer; }
.card-opt input { position: absolute; opacity: 0; pointer-events: none; }
.card-opt .ic { grid-row: span 2; width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: var(--panel); color: var(--ink-2); align-self: center; }
.card-opt .ic svg { width: 22px; height: 22px; }
.card-opt b { font-weight: 700; font-size: 14px; }
.card-opt span.t { font-size: 12.5px; color: var(--ink-2); line-height: 1.35; }
.card-opt:hover { border-color: var(--edge-hi); }
.card-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-bg); }
.card-opt:has(input:checked) .ic { background: var(--accent); color: var(--accent-ink); }
.card-opt:has(input:checked) span.t { color: var(--ink); }
.card-opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* slot chips (checkbox) */
.chips { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.chip { position: relative; display: flex; align-items: center; gap: 8px; padding: 8px 9px; border: 1px solid var(--edge); border-radius: var(--r); background: var(--raise); cursor: pointer; font-weight: 600; font-size: 13px; line-height: 1.2; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip .slots { width: 34px; height: 20px; flex: none; color: var(--ink-3); }
.chip .tick { margin-left: auto; width: 17px; height: 17px; border-radius: 5px; border: 1.5px solid var(--edge-hi); display: grid; place-items: center; color: transparent; flex: none; }
.chip .tick svg { width: 11px; height: 11px; stroke-width: 2.4; }
.chip:hover { border-color: var(--edge-hi); }
.chip:has(input:checked) { border-color: var(--accent); background: var(--accent-bg); }
.chip:has(input:checked) .slots { color: var(--accent); }
.chip:has(input:checked) .tick { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip:has(input:disabled) { opacity: .4; cursor: default; }

/* advanced options */
.adv { border-top: 1px solid var(--edge); padding-top: 10px; }
.adv summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-weight: 600; font-size: 13px; }
.adv summary::-webkit-details-marker { display: none; }
.adv summary svg { width: 14px; height: 14px; transition: transform .15s; }
.adv[open] summary svg { transform: rotate(90deg); }
.adv .ops { display: grid; gap: 6px; margin-top: 10px; }
.ck { display: flex; gap: 10px; align-items: center; cursor: pointer; font-size: 13px; color: var(--ink-2); }
.ck input { appearance: none; width: 16px; height: 16px; margin: 0; border: 1.5px solid var(--edge-hi); border-radius: 4px; background: var(--field); flex: none; }
.ck input:checked { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 3px var(--accent-bg); }
.ck b { color: var(--ink); font-weight: 600; }

/* ---------- item preview (read-only card, middle) ---------- */
.stage { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 22px 20px; min-height: 0; overflow: auto; }
.stage-h { text-align: center; }
.stage-h h2 { font-size: 15px; font-weight: 750; display: flex; align-items: center; justify-content: center; gap: 7px; color: var(--ink); }
.stage-h h2 svg { width: 18px; height: 18px; color: var(--accent); }
.stage-h p { color: var(--ink-3); font-size: 12.5px; margin-top: 1px; }

.cut { --cut: 14px; clip-path: polygon(var(--cut) 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, var(--cut) 100%, 0 calc(100% - var(--cut)), 0 var(--cut)); }
.card { width: min(420px, 100%); padding: 1px; background: var(--card-edge); }
.card-in { background: var(--card); padding: 16px 18px 14px; text-align: center; }
.card .rar { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--magic); opacity: .75; }
.rule { margin: 8px auto 4px; font-size: 12.5px; color: var(--ink-2); }
.rule b { color: var(--ink); font-weight: 700; }
.row { display: flex; align-items: center; gap: 10px; margin: 8px 0; padding: 8px 10px; border-radius: 8px; text-align: left; border: 1.5px solid transparent; }
.row .sl { width: 28px; height: 28px; flex: none; border-radius: 7px; display: grid; place-items: center; background: var(--raise); color: var(--ink-3); }
.row .sl svg { width: 18px; height: 18px; }
.row .k { display: block; font-size: 11px; font-weight: 700; color: var(--ink-3); }
.row .v { display: block; font-size: 14px; font-weight: 650; color: var(--ink-3); }
.row .v .or { color: var(--ink-3); font-weight: 500; }
.row.need { border-color: var(--need-edge); border-style: dashed; background: var(--need-bg); }
.row.need .sl { background: var(--accent-bg); color: var(--accent); }
.row.need .v { color: var(--ink); }
.tag { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font: 800 11px/1 var(--ui); margin-left: 5px; vertical-align: 1px; }
.pname { color: var(--magic); font: 750 clamp(22px, 2.2vw, 29px)/1.15 var(--ui); letter-spacing: -.01em; padding: 2px 0; overflow-wrap: anywhere; }
.pname.empty { color: var(--magic-dim); font-weight: 600; }
.sep { height: 1px; margin: 10px 0; background: linear-gradient(90deg, transparent, var(--card-edge), transparent); }
.mentions { display: flex; align-items: flex-start; gap: 10px; padding: 9px 11px; border-radius: 8px; background: var(--note-bg); text-align: left; }
.mentions svg { width: 20px; height: 20px; color: var(--magic); margin-top: 1px; }
.mentions .k { font-size: 11px; font-weight: 700; color: var(--ink-3); display: block; }
.mentions .v { font-size: 14px; color: var(--ink); }
.mentions .v b { color: var(--magic); font-weight: 700; }
.mentions.none .v { color: var(--ink-3); }
.pnote { font-size: 12px; color: var(--ink-3); margin-top: 8px; }

/* quick starts + how-to steps */
.quick { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 7px; }
.quick .lab { font-size: 12.5px; color: var(--ink-3); }
.qs { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--edge); background: var(--panel); border-radius: 999px; padding: 4px 11px 4px 5px; cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.qs .ic { width: 22px; height: 22px; border-radius: 50%; background: var(--raise); display: grid; place-items: center; color: var(--accent); }
.qs .ic svg { width: 14px; height: 14px; }
.qs:hover { color: var(--ink); border-color: var(--edge-hi); }
.qs.on { border-color: var(--accent); color: var(--ink); }
.steps { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--ink-2); padding-top: 10px; border-top: 1px solid var(--edge); width: min(420px, 100%); }
.steps li { display: flex; align-items: center; gap: 8px; }
.steps .n { flex: none; width: 19px; height: 19px; border-radius: 50%; background: var(--raise); color: var(--accent); display: grid; place-items: center; font-weight: 750; font-size: 11px; }

/* ---------- search + check column (right) ---------- */
.side { border-left: 1px solid var(--edge); background: var(--panel); display: flex; flex-direction: column; min-height: 0; overflow: auto; }
.blk { padding: 14px 18px; display: flex; flex-direction: column; gap: 10px; }
.blk + .blk { border-top: 1px solid var(--edge); }
.bh { display: flex; align-items: center; gap: 8px; }
.bh svg.big { width: 21px; height: 21px; color: var(--accent); }
.bh h2 { font-size: 16px; font-weight: 750; letter-spacing: -.01em; }
.bh .aside { margin-left: auto; font-size: 12px; color: var(--ink-3); }
.searchbox { display: flex; align-items: flex-start; gap: 10px; background: var(--field); border: 1px solid var(--edge-hi); border-radius: 9px; padding: 10px 12px; }
.searchbox svg { width: 19px; height: 19px; color: var(--ink-3); margin-top: 1px; }
.searchbox code { font: 500 15px/1.45 var(--mono); color: var(--ink); overflow-wrap: anywhere; min-width: 0; }
.searchbox code .qt { color: var(--ink-3); }
.searchbox .empty { font: italic 400 14px var(--ui); color: var(--ink-3); }
.fit { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 12px; align-items: center; }
.bar { height: 7px; border-radius: 4px; background: var(--field); border: 1px solid var(--edge); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); transition: width .2s; }
.fit.over .bar i { background: var(--fail); }
.fit .num { font-size: 12px; color: var(--ink-3); white-space: nowrap; cursor: help; border-bottom: 1px dotted var(--edge-hi); }
.fit .note { grid-column: 1 / -1; display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); }
.fit .note svg { width: 15px; height: 15px; color: var(--pass); }
.fit.over .note svg { color: var(--fail); }
.copy { display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; padding: 10px 16px; border: 0; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-weight: 750; font-size: 15px; cursor: pointer; }
.copy svg { width: 19px; height: 19px; stroke-width: 1.9; }
.copy:hover { background: var(--accent-hi); }
.copy:active { transform: translateY(1px); }
.copy:disabled { background: var(--raise); color: var(--ink-3); cursor: default; }
.copy.done { background: var(--pass); }
.looks .lab { font-size: 12px; color: var(--ink-3); margin-bottom: 3px; }
.looks li { display: flex; gap: 8px; align-items: baseline; font-size: 13px; color: var(--ink-2); padding: 1px 0; }
.looks li .tag { margin: 0; flex: none; transform: translateY(-1px); }
.looks li b { color: var(--ink); font-weight: 650; }

/* item check: paste box, samples, verdict, redrawn item */
.paste { font: 400 12px/1.45 var(--mono); color: #c9cad0; resize: none; height: 50px; white-space: pre; overflow: auto; }
.samples { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.samples .lab { font-size: 12px; color: var(--ink-3); }
.sbtn { border: 1px solid var(--edge); background: var(--raise); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.sbtn:hover { color: var(--ink); border-color: var(--edge-hi); }
.verdict { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 2px 12px; align-items: center; padding: 11px 13px; border-radius: 9px; background: var(--raise); }
.verdict .big { grid-row: span 2; width: 42px; height: 42px; border-radius: 50%; background: var(--panel); color: var(--ink-2); display: grid; place-items: center; }
.verdict .big svg { width: 25px; height: 25px; stroke-width: 2; }
.verdict h3 { font-size: 18.5px; font-weight: 800; letter-spacing: -.015em; line-height: 1.15; }
.verdict p { font-size: 12.5px; color: var(--ink-2); }
.verdict p b { color: var(--ink); font-weight: 650; }
.verdict.pass { background: var(--pass-bg); }
.verdict.pass .big { background: var(--pass); color: var(--pass-ink); }
.verdict.pass h3 { color: var(--pass); }
.got { --cut: 11px; padding: 1px; background: var(--card-edge); }
.got-in { background: var(--card); padding: 11px 13px; text-align: center; font-size: 12.5px; color: var(--ink-2); }
.got .gn { font-size: 16px; font-weight: 750; color: var(--magic); line-height: 1.25; }
.got .gn .hit { color: var(--ink); background: var(--hit-bg); border-radius: 4px; padding: 0 4px; }
.got .gn .free { display: inline-block; border: 1.5px dashed var(--pass); border-radius: 4px; color: var(--pass); font-size: 11px; font-weight: 700; padding: 0 5px; vertical-align: 2px; }
.got .gs { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--card-line); }
.got .gs p { line-height: 1.4; }
.got .gs .m { color: var(--magic-2); }
.got .gs .m.hit { color: var(--ink); background: var(--hit-bg); border-radius: 4px; padding: 0 4px; }
.got.pass { background: var(--pass); }
.got.empty .got-in { color: var(--ink-3); font-style: italic; padding: 16px 13px; }

/* ---------- tooltip (any element with data-tip="Title|Text") ---------- */
.tip { position: fixed; z-index: 60; max-width: 280px; padding: 9px 11px; border-radius: 7px; background: var(--tip-bg); border: 1px solid var(--tip-edge); color: var(--ink); font-size: 13px; line-height: 1.4; pointer-events: none; opacity: 0; transform: translateY(3px); transition: opacity .12s, transform .12s; }
.tip.show { opacity: 1; transform: none; }
.tip b { display: block; font-weight: 700; margin-bottom: 2px; color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .tip, .bar i, .adv summary svg { transition: none; } }

/* ---------- narrower screens ---------- */
@media (max-width: 1180px) {
  html, body { height: auto; }
  .app { height: auto; grid-template-rows: none; }
  .work { grid-template-columns: 350px minmax(0, 1fr); }
  .form, .stage, .side { overflow: visible; }
  .side { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--edge); }
}
@media (max-width: 760px) {
  .top { height: auto; flex-wrap: wrap; gap: 8px 16px; padding: 10px 14px; }
  .tools { flex: 1 1 100%; flex-wrap: wrap; }
  .tool { padding: 6px 10px; }
  .work { grid-template-columns: minmax(0, 1fr); }
  .form { border-right: 0; padding: 16px 14px; }
  .stage { padding: 20px 14px; border-top: 1px solid var(--edge); }
  .blk { padding: 14px; }
  .hub { padding: 18px 14px 24px; }
  .legal { padding: 11px 14px 13px; }
}
@media (max-width: 380px) { .chips { grid-template-columns: minmax(0, 1fr); } }
