/* Ink-painting skin: commerce. Loaded after every other stylesheet; overrides live here. */

/* ── 1. 商 the merchant's shelf ─────────────────────────────────────────────
   A ledger on paper, not a table of boxes: each ware sits in a square parchment slot (the hotbar's own slot), its rarity a thin
   ink line under the slot rather than a coloured stripe down the row; the price is a quiet paper chit, cinnabar only when you
   cannot pay it. */
#shop{--cm-rule:rgba(43,42,46,.13);--cm-slot:#f6efdf;--cm-dim:rgba(43,42,46,.62)}
#shop>.close{top:6px;right:8px;border:0;background:none;color:var(--cm-dim);font-size:11px;letter-spacing:.16em;padding:4px 6px}
#shop>.close:hover{background:none;color:var(--red)}
#shop h3{font-size:22px;letter-spacing:.06em;line-height:1.25;margin:0 0 4px;padding-right:80px}
#shop h3::first-letter{color:var(--red)}
#shop .sub{opacity:1;color:var(--cm-dim);font-size:12px;line-height:1.55;letter-spacing:.02em;max-width:68ch;margin-bottom:10px}
#shop .sub[style]{max-width:none;margin-top:16px!important;padding-top:10px;border-top:1px solid var(--cm-rule);color:var(--ink);opacity:.72}

#shop .it,
#shop .it:is([data-tier="rare"],[data-tier="legend"],[data-tier="myth"],[data-tier="celestial"]){
  display:grid;grid-template-columns:44px minmax(140px,172px) minmax(0,1fr) 58px auto;column-gap:12px;align-items:center;
  padding:9px 2px 9px 0;border:0;border-top:1px solid var(--cm-rule);border-radius:0;box-shadow:none;background:none}
#shop .it>.ware-icon{grid-column:1;width:44px;height:44px;flex:none;padding:5px;box-sizing:border-box;background:var(--cm-slot);
  border:1px solid rgba(43,42,46,.18);border-radius:2px;box-shadow:inset 0 -2px 0 var(--tc,rgba(43,42,46,.18)),0 1px 2px rgba(43,42,46,.08);filter:none}
#shop .it>.n{grid-column:2;width:auto;min-width:0;font-size:14px;line-height:1.3}
#shop .it>.n small{display:block;font-size:11px;letter-spacing:.02em;opacity:1!important;color:var(--cm-dim);margin-top:2px;white-space:normal}
#shop .it>.d{grid-column:3;font-size:12px;line-height:1.5;opacity:1;color:rgba(43,42,46,.78)}
#shop .it>.tag{grid-column:4;width:auto;font-size:9.5px;letter-spacing:.14em;opacity:1;color:var(--cm-dim);text-align:right}
#shop .it>button{grid-column:5;justify-self:end;min-width:64px;box-sizing:border-box;padding:5px 10px;font-size:13px;line-height:1.2;
  font-variant-numeric:tabular-nums;color:var(--ink);background:rgba(255,251,240,.55);border:1px solid rgba(43,42,46,.45);border-radius:2px;
  box-shadow:0 1px 2px rgba(43,42,46,.1);transition:color .15s,border-color .15s,background-color .15s}
#shop .it>button:not(:disabled):hover{color:var(--red);border-color:var(--red);background:rgba(255,251,240,.85)}
#shop .it>button:focus-visible{outline:1.5px solid var(--red);outline-offset:2px}
/* what you cannot pay for: the chit goes flat and the sum turns cinnabar, so the shortfall reads at a glance and not as a greyed-out blur */
#shop .it>button:disabled{opacity:1;color:rgba(179,56,43,.82);background:none;border:1px dashed rgba(179,56,43,.38);box-shadow:none}
#shop .it>button:disabled img{filter:grayscale(1);opacity:.55}
#shop .it:has(>button:disabled)>.ware-icon{opacity:.72}
#shop b.ware-icon.glyph{font-size:22px;opacity:.8}

@media (max-width:700px){
  #shop h3{font-size:19px;padding-right:56px}
  #shop .it,
  #shop .it:is([data-tier="rare"],[data-tier="legend"],[data-tier="myth"],[data-tier="celestial"]){
    grid-template-columns:40px minmax(0,1fr) auto;row-gap:4px;column-gap:10px;align-items:start;padding:10px 0}
  #shop .it>.ware-icon{grid-row:1/span 2;width:40px;height:40px}
  #shop .it>.n{grid-column:2;grid-row:1;align-self:center}
  #shop .it>button{grid-column:3;grid-row:1;align-self:center}
  #shop .it>.d{grid-column:2/span 2;grid-row:2}
  #shop .it>.tag{display:none}
}

/* ── 2. 市 the free market ─────────────────────────────────────────────────
   The merchant's ledger again, so the two counters read as one hand: parchment slots, hairline rows, paper chits; the stalls you
   cannot afford say so in cinnabar. The Buy / Sell switch is a pair of written tabs, not two boxed buttons. */
#market{--cm-rule:rgba(43,42,46,.13);--cm-slot:#f6efdf;--cm-dim:rgba(43,42,46,.62)}
#market>.close{top:6px;right:8px;border:0;background:none;color:var(--cm-dim);font-size:11px;letter-spacing:.16em;padding:4px 6px}
#market>.close:hover{background:none;color:var(--red)}
#market h3{font-size:22px;letter-spacing:.06em;line-height:1.25;margin:0 0 6px;padding-right:72px;align-items:baseline}
#market .purse-line{font-size:13px;letter-spacing:.02em;opacity:1;color:var(--ink);font-variant-numeric:tabular-nums;white-space:nowrap}
#market .purse-line img{width:15px;height:15px;opacity:.9}
#market .mtabs{gap:22px;margin:4px 0 8px;border-bottom:1px solid var(--cm-rule)}
#market .mtab{border:0;border-bottom:1.5px solid transparent;margin-bottom:-1px;padding:4px 0 6px;font-size:13px;letter-spacing:.06em;background:none;opacity:1;color:var(--cm-dim)}
#market .mtab:hover{color:var(--ink);border-color:rgba(43,42,46,.35)}
#market .mtab.on{color:var(--red);border-color:var(--red);background:none}
#market .shop-body{padding-bottom:14px}
#market .sub{opacity:1;color:var(--cm-dim);font-size:12px;line-height:1.55;max-width:72ch}

#market .it,
#market .it:is([data-tier="rare"],[data-tier="legend"],[data-tier="myth"],[data-tier="celestial"]){
  display:grid;grid-template-columns:38px minmax(140px,180px) minmax(0,1fr) 78px minmax(86px,auto);column-gap:12px;align-items:center;
  padding:6px 2px 6px 0;border:0;border-top:1px solid var(--cm-rule);border-radius:0;box-shadow:none;background:none}
#market .it>.ware-icon{grid-column:1;width:38px;height:38px;flex:none;padding:4px;box-sizing:border-box;background:var(--cm-slot);
  border:1px solid rgba(43,42,46,.18);border-radius:2px;box-shadow:inset 0 -2px 0 var(--tc,rgba(43,42,46,.18)),0 1px 2px rgba(43,42,46,.08);filter:none}
#market .it>.n{grid-column:2;width:auto;min-width:0;font-size:14px;line-height:1.25;white-space:normal}
#market .it>.n small{display:block;font-size:11px;opacity:1!important;color:var(--cm-dim);margin-top:1px}
#market .it>.d{grid-column:3;font-size:12px;line-height:1.4;opacity:1;color:rgba(43,42,46,.78)}
#market .it>.price,#market .it>.d.price{grid-column:4;flex:none;font-size:14px;opacity:1;color:var(--ink);text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}
#market .it>.act{grid-column:5;min-width:0;margin:0}
#market .it button{min-width:72px;box-sizing:border-box;padding:4px 10px;font-size:12.5px;line-height:1.2;letter-spacing:.04em;color:var(--ink);
  background:rgba(255,251,240,.55);border:1px solid rgba(43,42,46,.45);border-radius:2px;box-shadow:0 1px 2px rgba(43,42,46,.1);transition:color .15s,border-color .15s,background-color .15s}
#market .it button:not(:disabled):hover{color:var(--red);border-color:var(--red);background:rgba(255,251,240,.85)}
#market .it button:focus-visible,#market .mtab:focus-visible{outline:1.5px solid var(--red);outline-offset:2px}
#market .it button:disabled{opacity:1;color:rgba(179,56,43,.75);background:none;border:1px dashed rgba(179,56,43,.36);box-shadow:none}
#market .it:has(button:disabled)>.price{color:rgba(179,56,43,.85)}
#market .it:has(button:disabled)>.ware-icon{opacity:.72}
#market .it .act .why{font-size:10.5px;letter-spacing:.02em;opacity:1;color:rgba(179,56,43,.85);white-space:nowrap}
/* what your stalls sold, waiting to be taken: the one row worth a touch of cinnabar */
#market .it.purse{background:rgba(179,56,43,.045);border-top:1px solid rgba(179,56,43,.25);border-bottom:1px solid rgba(179,56,43,.25);padding-left:6px;margin-bottom:2px}
#market .it.purse>.ware-icon{background:#fbf3e3}
#market .it.purse button{color:var(--red);border-color:var(--red)}
#market .it.purse button:hover{color:var(--paper)!important;background:var(--red)!important}
#market .it.owned>.n small{color:var(--red);opacity:.85!important}
#market .it .ask input,#market .it .ask select{background:rgba(255,251,240,.6);border-color:rgba(43,42,46,.3);border-radius:2px}
#market .it .ask input:focus,#market .it .ask select:focus{outline:none;border-color:var(--red)}

@media (max-width:700px){
  #market h3{font-size:19px;padding-right:56px;flex-wrap:wrap;row-gap:2px;margin-bottom:2px}
  #market .mtabs{margin:2px 0 4px}
  #market .it,
  #market .it:is([data-tier="rare"],[data-tier="legend"],[data-tier="myth"],[data-tier="celestial"]){
    grid-template-columns:34px minmax(0,1fr) auto auto;row-gap:2px;column-gap:8px;align-items:center;padding:7px 0}
  #market .it>.ware-icon{grid-row:1/span 2;align-self:start;width:34px;height:34px;padding:3px}
  #market .it>.n{grid-column:2;grid-row:1;font-size:13.5px}
  #market .it>.price,#market .it>.d.price{grid-column:3;grid-row:1;font-size:13px}
  #market .it>.act{grid-column:4;grid-row:1}
  #market .it button{min-width:0;padding:4px 9px}
  #market .it>.d{grid-column:2/-1;grid-row:2;-webkit-line-clamp:2;font-size:11.5px}
  #market .it .act .why{font-size:10px}
  #market .it.purse{padding-left:0}
  #market .it.purse>.n small{display:none}
}

/* ── 3. 囊 what you carry: the Character sheet's inventory and worn squares ──
   The well stays sunk into the sheet but in warm paper shade, not grey; the plain tiers sit on parchment with an ink-thin tier edge;
   section heads are written on a hairline. 傳 legend, 神 myth and 天 celestial keep their own grounds, drift, rake and stars untouched. */
#character .char-right>.shop-body{background:linear-gradient(rgba(120,96,60,.085),rgba(120,96,60,.085)),rgba(255,250,238,.35);
  border:1px solid rgba(43,42,46,.16);box-shadow:inset 0 1px 3px rgba(60,44,20,.14);padding:8px 10px 10px 10px}
#items{gap:10px 10px}
#items .t{display:block;width:100%;box-sizing:border-box;margin:6px 0 0;padding:0 0 5px;border-bottom:1px solid rgba(43,42,46,.16);
  font-size:10.5px;letter-spacing:.14em;opacity:1;color:rgba(43,42,46,.66)}
#items .t:first-child{margin-top:0}
#items .it:is([data-tier="ungraded"],[data-tier="common"],[data-tier="uncommon"],[data-tier="rare"]){
  background:linear-gradient(color-mix(in srgb,var(--tc) 7%,transparent),color-mix(in srgb,var(--tc) 7%,transparent)),#f8f2e3;
  border:1px solid color-mix(in srgb,var(--tc) 62%,#cdbf9f);box-shadow:0 1px 2px rgba(43,42,46,.1)}
#items .it[data-tier="ungraded"]{--tc:#8f8471;background:#f8f2e3;border-color:rgba(43,42,46,.2)}
#items .it[data-tier="ungraded"] img{filter:none;opacity:.88}
#items .it span{font-size:12.5px;letter-spacing:.01em;color:var(--ink);opacity:1}
#items .it[data-tier="celestial"] span{color:transparent}
#items .it .qty{opacity:.7;font-size:11.5px}
#items .it.res em{opacity:.7}
#items .it{transition:transform .15s ease-out,box-shadow .15s ease-out}
#items .it:not(.keep):hover{transform:translateY(-2px);color:inherit}
#items .it:not(.keep):not(.on):is([data-tier="ungraded"],[data-tier="common"],[data-tier="uncommon"],[data-tier="rare"]):hover{border-color:var(--red);box-shadow:0 5px 10px rgba(43,42,46,.18)}
#items .it button{color:var(--red);border-color:rgba(179,56,43,.45);background:rgba(255,251,240,.5);letter-spacing:.08em}
#items .it button:hover{background:var(--red);color:var(--paper)}
#items .it:focus-visible,#items .it button:focus-visible{outline:1.5px solid var(--red);outline-offset:2px}
#character .eq-slot>small{opacity:1;color:rgba(43,42,46,.62);letter-spacing:.14em}
#character .acc-slot.empty{opacity:1;color:rgba(43,42,46,.35);border:1px dashed rgba(43,42,46,.3);background:rgba(255,250,238,.4)}
/* a phone fits fewer px per card: the grade stars shrink to stay inside the frame instead of spilling past its edges */
@media (max-width:700px){
  #items .it .stars{font-size:9px;letter-spacing:.5px;text-indent:.5px;white-space:nowrap}
  #items .it span{font-size:11.5px}
}

/* ── 4. 籤 an item's hover card ────────────────────────────────────────────
   A slip of solid parchment lifted off the sheet by a soft ink shadow: the name reads first and larger, the effect in full ink,
   and the hint (click to wear · worn) is set apart under a hairline. Only cards (.card) — the map's one-line name tips are not ours. */
#tip:has(>.card){padding:10px 13px 10px;background:#f7f0e1;border:1px solid rgba(43,42,46,.22);border-radius:2px;
  box-shadow:0 8px 20px rgba(43,42,46,.2),0 1px 3px rgba(43,42,46,.12);letter-spacing:.01em}
#tip>.card{width:max-content;max-width:330px;min-width:180px;font-size:12.5px;line-height:1.55;color:rgba(43,42,46,.88)}
#tip>.card>b:first-child{font-size:13.5px;letter-spacing:.02em;line-height:1.35;color:var(--red)}
#tip>.card>span:last-child{display:block;margin-top:7px;padding-top:6px;border-top:1px solid rgba(43,42,46,.14);font-size:11px;letter-spacing:.06em;opacity:1!important;color:rgba(43,42,46,.6)}

/* ── 5. 部曲 the band: soldiers, what to arm them with, what they cost ──────
   The roster is a quiet ledger (parchment, a thin tier line under each portrait, cinnabar for the one picked); the sheet leads with
   the kind's name in ink beside its figure; each weapon card names what it makes (from the card's own title) above its numbers and
   cost, on parchment rather than a grey slab, with a paper chit to equip. */
#band{--cm-rule:rgba(43,42,46,.13);--cm-dim:rgba(43,42,46,.62)}
#band :is(.pick-row,.sheet,.card)[data-tier="common"]{--tc:var(--t-common)}
#band :is(.pick-row,.sheet,.card)[data-tier="uncommon"]{--tc:var(--t-uncommon)}
#band :is(.pick-row,.sheet,.card)[data-tier="rare"]{--tc:var(--t-rare)}
#band :is(.pick-row,.sheet,.card)[data-tier="legend"]{--tc:var(--t-legend)}
#band .purse{gap:22px;padding:2px 2px 8px;margin:0 0 10px;border:0;border-bottom:1px solid var(--cm-rule);font-size:12px;color:var(--cm-dim)}
#band .purse b{color:var(--ink);font-size:15px;font-variant-numeric:tabular-nums}

#band .pick-row,#band .pick-row[data-tier]{gap:10px;padding:6px 8px 6px 4px;margin:0;border-left:0;border-bottom:1px solid var(--cm-rule);background:none;font-size:13px;color:var(--ink)}
#band .pick-row:hover{background:rgba(43,42,46,.04)}
#band .pick-row.on,#band .pick-row.on[data-tier]{color:var(--red);background:rgba(179,56,43,.06);box-shadow:inset 2px 0 0 var(--red)}
#band .pick-row em{font-size:13px;opacity:1;color:var(--cm-dim)}
#band .pick-row>span:not(.por)::after{content:"";display:inline-block;width:5px;height:5px;margin-left:7px;vertical-align:2px;border-radius:50%;background:var(--tc,transparent)}
#band .pick-row.on em{color:var(--red)}

#band .sheet .kind{align-items:flex-end;gap:12px;margin:0 0 10px}
#band .sheet .kind em,#band .sheet[data-tier] .kind em{margin-left:0;padding-bottom:2px;font-size:18px;letter-spacing:.04em;color:var(--ink);opacity:1}
#band .st-rows{gap:0;display:grid;grid-auto-flow:column;grid-auto-columns:auto;justify-content:stretch;margin:0 0 10px;border-top:1px solid var(--cm-rule);border-bottom:1px solid var(--cm-rule)}
#band .st-rows>span{flex:1 1 0;min-width:0;border:0;border-radius:0;padding:7px 4px 6px;display:flex;flex-direction:column;justify-content:space-between}
#band .st-rows>span+span{border-left:1px solid var(--cm-rule)}
#band .st-rows i{font-size:9.5px;line-height:1.25;letter-spacing:.08em;opacity:1;color:var(--cm-dim)}
#band .st-rows b{font-size:15px}
#band .sheet .bd,#band .note{font-size:12.5px;line-height:1.55;color:rgba(43,42,46,.8);opacity:1}
#band .pick{font-size:10.5px;letter-spacing:.14em;text-transform:uppercase;opacity:1;color:var(--cm-dim);margin:14px 0 6px}

#band .card,#band .card[data-tier]{display:grid;grid-template-columns:64px minmax(0,1fr) auto;grid-template-rows:auto auto;column-gap:12px;row-gap:1px;align-items:center;
  padding:8px 10px 8px 6px;margin:0 0 8px;border:1px solid rgba(43,42,46,.16);border-radius:2px;
  background:linear-gradient(color-mix(in srgb,var(--tc,transparent) 6%,transparent),color-mix(in srgb,var(--tc,transparent) 6%,transparent)),#f8f2e3;
  box-shadow:inset 0 -2px 0 color-mix(in srgb,var(--tc,rgba(43,42,46,.3)) 70%,transparent),0 1px 2px rgba(43,42,46,.08)}
#band .card::before{content:attr(title);grid-column:2;grid-row:1;align-self:end;font-size:14px;letter-spacing:.02em;color:var(--ink);text-transform:capitalize}
#band .card>.por,#band .card>.seal{grid-column:1;grid-row:1/span 2;justify-self:center}
#band .card>.mid{grid-column:2;grid-row:2;align-self:start}
#band .card>button{grid-column:3;grid-row:1/span 2}
#band .card .st{font-size:11.5px;opacity:1;color:var(--cm-dim)}
#band .card .cost{font-size:12px;opacity:1;color:var(--ink);font-variant-numeric:tabular-nums;margin-top:2px}
#band .card .cost .ra{width:18px;height:18px;vertical-align:-4px}
#band .card:hover{border-color:rgba(179,56,43,.55)}
#band .card>button{min-width:78px;padding:6px 12px;font-size:12.5px;letter-spacing:.06em;color:var(--red);background:rgba(255,251,240,.6);border:1px solid var(--red);border-radius:2px;
  transition:background-color .15s,color .15s}
#band .card>button:not(:disabled):hover{background:var(--red);color:var(--paper)}
#band .card>button:focus-visible,#band .pick-row:focus-visible{outline:1.5px solid var(--red);outline-offset:2px}
#band .card>button:disabled{opacity:1;color:rgba(43,42,46,.45);background:none;border:1px dashed rgba(43,42,46,.3)}
#band .card.off::before{color:rgba(43,42,46,.6)}
#band .release{margin:14px auto 2px;padding:5px 14px;border-color:rgba(179,56,43,.3);border-radius:2px;font-size:11.5px;letter-spacing:.08em;background:none}
#band .release:hover{border-color:var(--red)}

@media (max-width:700px){
  #band .st-rows{flex-wrap:wrap}
  #band .st-rows>span{flex:1 0 30%}
  #band .st-rows>span:nth-child(4){border-left:0}
  #band .st-rows>span:nth-child(n+4){border-top:1px solid var(--cm-rule)}
  #band .card,#band .card[data-tier]{grid-template-columns:48px minmax(0,1fr) auto;column-gap:10px}
  #band .card>.por{width:48px}
}
