/* Swing Tags - a shop rail: linen ground, charcoal type, a chrome rail with wire hangers, kraft swing tags on string,
 * rubber-stamp conditions and one colour per lean (list = bottle green, add info = ochre, bundle = denim, donate = plum). */
:root {
  --bg: #f4f1ec; --card: #fffdf9; --card2: #f7f2ea; --ink: #1e1c1a; --muted: #5d5850; --line: #ddd5c8;
  --brand: #1e1c1a; --brand-ink: #fffdf9; --accent: #b3311d; --focus: #b3311d;
  --kraft: #e6cfa6; --kraft2: #d8bb8a; --kraft-ink: #33240f; --kraft-muted: #5e4626; --string: #6d5a45; --rail1: #c9ccd1; --rail2: #8a8f97; --hook: #70757d;
  --stamp: #8c2010;
  --list: #2d6a3e; --add: #8a5300; --bundle: #2b5a8c; --donate: #6a4479;
  --list-bg: #dcefe1; --add-bg: #f7e6c6; --bundle-bg: #dde8f5; --donate-bg: #ece1f1;
  --ok: #2d6a3e; --warn: #8a4a00; --info: #2f5577;
  --shadow: 0 1px 2px rgba(40, 30, 20, .08), 0 8px 22px rgba(40, 30, 20, .07);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #151413; --card: #1f1d1b; --card2: #262320; --ink: #eee8de; --muted: #b3aa9c; --line: #3a3630;
  --brand: #eee8de; --brand-ink: #151413; --accent: #ff8f78; --focus: #ff8f78;
  --kraft: #4b3b27; --kraft2: #5a4730; --kraft-ink: #f6e7cb; --kraft-muted: #dcc6a0; --string: #a8927a; --rail1: #6b7078; --rail2: #3e4248; --hook: #9aa0a8;
  --stamp: #ffb8a8;
  --list: #9ad6a9; --add: #f3c56f; --bundle: #a9c8ef; --donate: #dcb5ea;
  --list-bg: rgba(110, 190, 130, .16); --add-bg: rgba(240, 180, 80, .16); --bundle-bg: rgba(120, 160, 220, .17); --donate-bg: rgba(200, 150, 220, .16);
  --ok: #9ad6a9; --warn: #f3c56f; --info: #a9c8ef;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 10px 24px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow-x: hidden; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.15; letter-spacing: -.015em; }
h1 { font-weight: 800; }
.hidden { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.small { font-size: 13px; } .muted { color: var(--muted); }
.warn { color: var(--warn); } .none { color: var(--muted); font-style: italic; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.mono, .tag, .stamp, .tprice, .lno, .kicker { font-family: ui-monospace, "SF Mono", Menlo, "Courier New", monospace; }

/* Header */
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 20px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.back { text-decoration: none; font-size: 14px; color: var(--muted); }
.brand { display: flex; align-items: center; gap: 8px; margin-right: auto; font-size: 17px; }
.logo { width: 30px; height: 30px; }
.lg-string { fill: none; stroke: var(--string); stroke-width: 1.4; } .lg-tag { fill: var(--kraft2); stroke: var(--kraft-ink); stroke-width: 1.2; stroke-linejoin: round; }
.lg-hole { fill: var(--card); stroke: var(--kraft-ink); stroke-width: 1; } .lg-line { stroke: var(--stamp); stroke-width: 1.8; stroke-linecap: round; }
.session { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.pill { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 5px 12px; font-size: 13px; cursor: pointer; text-decoration: none; color: var(--ink); }
.pill:hover { border-color: var(--ink); }
.pill.solid, .btn.solid { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.pill.ghost { background: transparent; cursor: default; }
.pill.tiny { padding: 2px 10px; font-size: 12px; }

/* Layout */
.wrap { max-width: 1200px; margin: 0 auto; padding: 20px 20px 40px; }
.hero { padding: 14px 0 6px; max-width: 860px; }
.kicker { text-transform: uppercase; letter-spacing: .14em; font-size: 12px; color: var(--accent); margin: 0; font-weight: 700; }
.hero h1 { font-size: clamp(30px, 5vw, 50px); margin: 6px 0 10px; }
.lede { color: var(--muted); font-size: 16px; margin: 0 0 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chips-label { font-size: 13px; color: var(--muted); }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 4px; padding: 6px 12px; cursor: pointer; font-size: 14px; }
.chip:hover { border-color: var(--ink); }
.chip.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.ghostchip { border-style: dashed; background: transparent; }
.two { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 22px; margin-top: 18px; align-items: start; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; box-shadow: var(--shadow); margin-top: 18px; }
.two > .card { margin-top: 0; }
.card h2 { font-size: 21px; margin: 0 0 10px; }
.h3 { font-size: 15px; margin: 16px 0 8px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
label { display: block; font-size: 13px; font-weight: 600; }
label > input, label > select, label > textarea { display: block; margin-top: 4px; }
label > .small { font-weight: 400; }
input, select, textarea { border: 1px solid var(--line); background: var(--card2); border-radius: 6px; padding: 8px 10px; font-weight: 400; font-size: 15px; width: 100%; min-width: 0; }
textarea { resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.span2 { grid-column: span 2; }
.lbl { margin-top: 12px; }
.drop { border: 1px dashed var(--line); border-radius: 8px; padding: 6px 10px 2px; margin-top: 12px; }
.drop.over { border-color: var(--accent); background: var(--card2); }
.filelink { display: inline; text-decoration: underline; cursor: pointer; font-weight: 400; color: var(--accent); }
.notes { margin: 10px 0 0; padding-left: 18px; }
.edhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.edhead h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* The rail: a chrome bar drawn at the top of every row, hangers hooked over it, tags on string. */
.railcard { margin-top: 22px; }
.railhead { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.railhead h2 { font-size: 22px; margin: 0; }
.rail { --row: 344px; display: flex; flex-wrap: wrap; gap: 0 14px; padding: 0 10px; margin-top: 10px; min-height: var(--row);
  background-image: linear-gradient(to bottom, transparent 7px, var(--rail1) 7px, var(--rail2) 13px, transparent 13px); background-size: 100% var(--row); background-repeat: repeat-y; }
.hanger { width: 150px; height: var(--row); position: relative; display: flex; flex-direction: column; align-items: center; }
.hook { width: 40px; height: 34px; display: block; flex: none; }
.hookline { fill: none; stroke: var(--hook); stroke-width: 2.4; stroke-linecap: round; }
.tagbtn { all: unset; cursor: pointer; display: flex; flex-direction: column; align-items: center; width: 100%; transform-origin: 50% 0; transition: transform .18s ease; }
.hanger:nth-child(odd) .tagbtn { transform: rotate(-2.2deg); } .hanger:nth-child(even) .tagbtn { transform: rotate(1.8deg); }
.tagbtn:hover, .hanger.sel .tagbtn { transform: rotate(0deg) translateY(4px); }
.tagbtn:focus-visible .tag { outline: 2px solid var(--focus); outline-offset: 3px; }
.string { width: 2px; height: 22px; background: var(--string); }
.tag { position: relative; width: 136px; height: 262px; background: var(--kraft); color: var(--kraft-ink); padding: 26px 10px 10px; display: flex; flex-direction: column; gap: 3px;
  clip-path: polygon(22% 0, 78% 0, 100% 12%, 100% 100%, 0 100%, 0 12%); box-shadow: inset 0 0 0 1px var(--kraft2); font-size: 12px; }
.hanger.sel .tag { background: var(--kraft2); }
.tag > * { flex: none; }
.hole { position: absolute; top: 9px; left: 50%; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--bg); box-shadow: inset 0 0 0 2px var(--kraft2); }
.tno { font-size: 10px; letter-spacing: .1em; color: var(--kraft-muted); text-align: center; }
.tname { font-family: system-ui, -apple-system, sans-serif; font-size: 13px; font-weight: 700; line-height: 1.2; text-align: center; height: 32px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tsize { font-size: 24px; font-weight: 700; text-align: center; line-height: 1.1; }
.tstamp { align-self: center; border: 2px solid var(--stamp); color: var(--stamp); padding: 1px 6px; font-size: 10px; font-weight: 800; letter-spacing: .08em; transform: rotate(-4deg); margin: 2px 0; white-space: nowrap; }
.tstamp.c-none { border-style: dashed; }
.tprice { font-size: 22px; font-weight: 700; text-align: center; margin-top: auto; }
.tbasis { font-size: 10.5px; color: var(--kraft-muted); text-align: center; }
.holes { display: flex; justify-content: center; gap: 4px; margin-top: 4px; }
.ph { width: 17px; height: 17px; border-radius: 50%; border: 1.5px dashed var(--kraft-muted); font-size: 9px; line-height: 14px; text-align: center; color: var(--kraft-muted); font-weight: 700; }
.ph.on { border: 1.5px solid var(--kraft-ink); background: var(--kraft-ink); color: var(--kraft); }
.tverdict { margin: 6px -10px -10px; padding: 4px 0; text-align: center; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: #fff; background: var(--list); }
.v-add .tverdict { background: var(--add); } .v-bundle .tverdict { background: var(--bundle); } .v-donate .tverdict { background: var(--donate); }
:root[data-theme="dark"] .tverdict { color: #151413; }
.blank .tag { opacity: .8; }
.ghosttag { background: transparent; box-shadow: none; border: 2px dashed var(--line); clip-path: none; border-radius: 4px; align-items: center; justify-content: center; color: var(--muted); }
.ghosttag .hole { box-shadow: inset 0 0 0 2px var(--line); }
.ghosttag .tbasis { color: var(--muted); }
.plus { font-size: 40px; font-weight: 300; line-height: 1; }
.addslot .string { visibility: hidden; }
.addslot .tagbtn { margin-top: 34px; transform: none; }
.counts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.count { border-radius: 4px; padding: 3px 10px; font-size: 13px; }
.count.v-list { background: var(--list-bg); color: var(--list); } .count.v-add { background: var(--add-bg); color: var(--add); }
.count.v-bundle { background: var(--bundle-bg); color: var(--bundle); } .count.v-donate { background: var(--donate-bg); color: var(--donate); }

/* Detail */
.badge { display: inline-block; font-size: 12px; border-radius: 4px; padding: 2px 8px; vertical-align: middle; font-weight: 700; font-family: system-ui, sans-serif; letter-spacing: 0; }
.badge:empty { display: none; }
.vb.v-list { background: var(--list-bg); color: var(--list); } .vb.v-add { background: var(--add-bg); color: var(--add); }
.vb.v-bundle { background: var(--bundle-bg); color: var(--bundle); } .vb.v-donate { background: var(--donate-bg); color: var(--donate); }
.checklist, .shots, .flags, .plain, .recon, .lask { list-style: none; padding: 0; margin: 0; }
.checklist li { padding: 5px 0 5px 24px; position: relative; border-bottom: 1px dotted var(--line); font-size: 14px; }
.checklist li::before { position: absolute; left: 2px; font-weight: 800; }
.checklist .have::before { content: "+"; color: var(--ok); } .checklist .miss::before { content: "!"; color: var(--warn); }
.checklist .sugg::before { content: "?"; color: var(--info); } .checklist .ok::before { content: "+"; color: var(--ok); } .checklist .cat::before { content: ">"; color: var(--muted); }
.checklist .miss { color: var(--warn); font-weight: 600; }
.strip { width: 100%; max-width: 420px; height: auto; display: block; }
.strip .axis { stroke: var(--line); stroke-width: 2; }
.strip .range { fill: var(--bundle-bg); }
.strip .comp { fill: var(--bundle); }
.strip .rough { fill: none; stroke: var(--add); stroke-width: 2; stroke-dasharray: 3 2; }
.strip .med { stroke: var(--ink); stroke-width: 2; }
.strip .lbl { fill: var(--muted); font-size: 11px; font-family: ui-monospace, Menlo, monospace; }
.pflag line { stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 2 2; }
.fl-list line { stroke: var(--list); stroke-dasharray: none; stroke-width: 2; } .fl-list .lbl { fill: var(--list); font-weight: 700; }
.take { color: var(--ok); font-weight: 600; }
.shots li { padding: 3px 0; font-size: 14px; }
.tick { display: flex; flex-direction: row; align-items: flex-start; gap: 8px; font-weight: 400; font-size: 14px; }
.tick input { width: auto; margin-top: 4px; }
.flags li { padding: 6px 0; border-bottom: 1px dotted var(--line); font-size: 14px; }
.lv { display: inline-block; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; border-radius: 3px; padding: 1px 6px; margin-right: 4px; }
.lv-warn .lv { background: var(--add-bg); color: var(--add); } .lv-info .lv { background: var(--bundle-bg); color: var(--info); } .lv-bundle .lv { background: var(--bundle-bg); color: var(--bundle); }
.flags .ok { color: var(--ok); }

/* Run */
.askrow { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.btn { border: 1px solid var(--line); border-radius: 6px; padding: 10px 18px; font-size: 15px; font-weight: 700; cursor: pointer; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.meter { color: var(--muted); }
.gate { color: var(--ink); font-size: 14px; margin: 10px 0 0; }
.gate .pill { margin-left: 4px; }
.steps { list-style: none; padding: 0; margin: 0; }
.step { padding: 3px 0; color: var(--muted); } .step.done { color: var(--ok); } .step.active { color: var(--ink); font-weight: 700; }
.step-ic { display: inline-block; width: 16px; font-family: ui-monospace, monospace; }
.raw { white-space: pre-wrap; word-break: break-word; max-height: 360px; overflow: auto; font-size: 12px; }

/* Listings */
.rdhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.stamp { border: 2.5px solid var(--stamp); color: var(--stamp); padding: 2px 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; transform: rotate(-3deg); font-size: 13px; }
.rdsummary { font-size: 16px; }
.partial { background: var(--add-bg); color: var(--add); padding: 8px 12px; border-radius: 6px; }
.listings, .bundles { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.listing { border: 1px solid var(--line); border-top: 5px solid var(--list); border-radius: 8px; padding: 12px 14px; background: var(--card2); display: flex; flex-direction: column; gap: 6px; }
.listing.v-add { border-top-color: var(--add); } .listing.v-bundle { border-top-color: var(--bundle); } .listing.v-donate { border-top-color: var(--donate); }
.lhead { display: flex; justify-content: space-between; align-items: center; }
.lno { font-size: 12px; color: var(--muted); letter-spacing: .08em; }
.ltitle { font-weight: 800; font-size: 16px; margin: 0; line-height: 1.3; }
.tlen { margin: 0; }
.ldesc { white-space: pre-wrap; margin: 0; font-size: 14px; }
.kws { display: flex; flex-wrap: wrap; gap: 5px; }
.kw { font-size: 12px; border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; color: var(--ink); background: var(--card); }
.lprice { font-size: 13px; margin: 0; color: var(--ink); border-left: 3px solid var(--line); padding-left: 8px; }
.lask li { font-size: 13px; color: var(--warn); padding-left: 16px; position: relative; }
.lask li::before { content: "!"; position: absolute; left: 3px; font-weight: 800; }
.listing .pill { align-self: flex-start; }
.lfoot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.posted-tick { font-size: 14px; }
.listing.posted { border-style: dashed; }
.plain li { padding: 4px 0; border-bottom: 1px dotted var(--line); }
.recon li { padding: 5px 0 5px 10px; border-left: 3px solid var(--line); margin: 4px 0; font-size: 14px; }
.recon li.warn { border-left-color: var(--add); color: var(--warn); } .recon li.info { border-left-color: var(--bundle); color: var(--info); }
.btnrow { display: flex; flex-wrap: wrap; gap: 8px; }
.hist { list-style: none; padding: 0; margin: 12px 0 0; }
.hrow { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.hinfo { display: flex; flex-direction: column; margin-right: auto; min-width: 0; }
.how p { margin: 0; }
.foot { max-width: 1200px; margin: 0 auto; padding: 10px 20px 40px; color: var(--muted); font-size: 13px; }
.toasts { position: fixed; bottom: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 20; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 8px; font-size: 14px; box-shadow: var(--shadow); transition: opacity .5s; }
.toast.err { background: var(--accent); color: #fff; } :root[data-theme="dark"] .toast.err { color: #151413; }
.toast a { color: inherit; font-weight: 700; }
.toast.gone { opacity: 0; }

/* Docs pages */
.doc { max-width: 900px; margin: 0 auto; padding: 24px 20px 40px; }
.doc pre { background: var(--card2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow: auto; font-size: 12.5px; line-height: 1.5; }
.doc code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .92em; }
.doc table { border-collapse: collapse; width: 100%; font-size: 14px; display: block; overflow-x: auto; }
.doc th, .doc td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.doc h1 { font-size: 2rem; } .doc h2 { font-size: 1.35rem; margin-top: 32px; } .doc h3 { font-size: 1.05rem; margin-top: 22px; }
.doc pre code { white-space: pre; } .doc td code { white-space: normal; }
.codegroup { margin: 10px 0 16px; }
.codegroup .tabs { display: inline-flex; flex-wrap: wrap; gap: 0; padding: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--card); margin-bottom: 6px; }
.codegroup .tab { border: none; border-right: 1px solid var(--line); background: var(--card); color: var(--ink); font-family: system-ui, sans-serif; padding: 5px 11px; cursor: pointer; font-size: 13px; }
.codegroup .tab.active { background: var(--brand); color: var(--brand-ink); font-weight: 700; }
.statebox { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.tokenrow { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.tokenbox { font-family: ui-monospace, Menlo, monospace; font-size: 13px; background: var(--card); border: 1px solid var(--line); padding: 8px 12px; border-radius: 8px; overflow-wrap: anywhere; flex: 1; }

@media (max-width: 860px) {
  .two { grid-template-columns: minmax(0, 1fr); }
  .two > .card + .card { margin-top: 18px; }
}
@media (max-width: 520px) {
  .wrap { padding: 14px 16px 30px; }
  .topbar { padding: 8px 12px; gap: 8px; } .back { display: none; }
  .grid2 { grid-template-columns: minmax(0, 1fr); } .span2 { grid-column: auto; }
  .rail { --row: 334px; gap: 0 6px; padding: 0 2px; justify-content: center; }
  .hanger { width: 112px; } .tag { width: 108px; height: 256px; padding: 24px 7px 8px; } .tsize { font-size: 20px; } .tprice { font-size: 18px; }
  .tverdict { margin: 6px -7px -8px; } .tstamp { font-size: 9px; padding: 1px 4px; } .ph { width: 15px; height: 15px; font-size: 8px; line-height: 12px; } .holes { gap: 2px; }
  .card { padding: 14px 14px; }
  .listings, .bundles { grid-template-columns: minmax(0, 1fr); }
}
@media print {
  .topbar, .hero, .two, .askcard, .exports, .history, .foot, .toasts, .progress-card, .addslot { display: none !important; }
  body.printing .readcard { display: block; }
  body { background: #fff; }
  .rail { background-image: none; } .hanger { break-inside: avoid; }
}
