.bazaar-ledger { max-width: 50rem; min-width: 0; }
.bazaar-ledger .bz-head {
  padding: .85rem 1rem; border: 1px solid #aa936d70; border-left: 3px solid #c39b63;
  background: linear-gradient(115deg,#a3854a23,#4e655014);
}
.bazaar-ledger .bz-head h3 { margin: .17rem 0; }
.bazaar-ledger .bz-head p { margin: 0; }
.bz-meta,.bz-tabs,.bz-actions,.bz-haggle { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.bz-meta { justify-content: space-between; font-size: .76rem; color: #cfbb91; }
.bz-open { color: #c4dfb0; } .bz-closed { color: #ecc6a1; }
.bazaar-ledger .bz-greeting { margin: .75rem .15rem; color: #e6d7b9; font-family: var(--serif,Georgia,serif); font-size: 1.04rem; }
.bz-tabs { padding: .45rem 0 .7rem; margin-bottom: .6rem; border-bottom: 1px solid #bda6784d; }
.bz-tabs button[aria-current] { background: #70634858; border-color: #c7a670; color: #f6e7c6; }
.bz-field { display: grid; gap: .15rem; margin: .35rem 0; min-width: 0; }
.bz-field span,.bz-note,.bz-article p,.bz-offer small,.bz-route small,.bz-receipt small { color: #c1c8ad; font-size: .79rem; }
.bz-article { display: flex; align-items: center; gap: .75rem; padding: .45rem 0; }
.bz-icon { display: block; flex: 0 0 3rem; width: 3rem; height: 3rem; }
.bz-icon svg { width: 100%; height: 100%; }
.bazaar-ledger .bz-article h4,.bazaar-ledger .bz-article p { margin: 0; }
.bz-stats { margin: .25rem 0 .5rem; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); border-block: 1px solid #bda67851; }
.bz-stats div { padding: .5rem .15rem; }
.bz-stats dt { color: #d2c3a2; font-size: .76rem; }
.bz-stats dd { margin: 0; color: #f8deaa; font-size: .98rem; font-variant-numeric: tabular-nums; }
.bz-actions,.bz-haggle { align-items: end; margin: .35rem 0 .7rem; }
.bz-actions .bz-field { width: 4rem; margin: 0; }
.bz-haggle .bz-field { width: 10rem; margin: 0; }
.bz-offer,.bz-route,.bz-receipt { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem; padding: .53rem 0; border-bottom: 1px solid #aaa88d35; }
.bz-offer>div,.bz-route>div,.bz-receipt strong { flex: 1 1 9rem; min-width: 0; }
.bz-route small,.bz-offer small { display: block; }
.bz-receipt { gap: .10rem .5rem; }
.bz-receipt small { flex-basis: 100%; }
.bz-receipt b { color: #dfc58e; font-variant-numeric: tabular-nums; font-weight: 550; }
.bz-chain { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .35rem; margin: .6rem 0; }
.bz-chain button { text-align: left; }
.bazaar-ledger :is(button,a):focus-visible { outline: 2px solid #edcf87; outline-offset: 2px; }
@media(max-width:450px) {
  .bz-tabs,.bz-actions { gap: .3rem; }
  .bz-tabs button,.bz-actions button,.bz-chain button { padding: .40rem .45rem; }
  .bz-route button,.bz-offer button { padding: .37rem .45rem; }
}

#game-panel:has(.merchant-counter){width:min(810px,calc(100vw - 24px));max-width:calc(100vw - 24px)}
.merchant-counter{margin:.5rem 0;color:#f0e6d0}
.merchant-shelves{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:.75rem}
.merchant-shelf{min-width:0;border:1px solid #b8965c77;border-radius:.35rem;background:#182923}
.merchant-shelf header{display:flex;align-items:baseline;justify-content:space-between;flex-wrap:wrap;gap:.2rem .45rem;padding:.6rem .65rem;border-bottom:1px solid #b8965c55}
.merchant-shelf h4{margin:0;color:#f0d394}.merchant-shelf small,.merchant-name small,.merchant-note{display:block;color:#c1c8b0;font-size:.78rem}
.merchant-slots{display:grid;align-content:start;gap:.25rem;padding:.35rem;max-height:16rem;overflow:auto}
.merchant-slot{display:grid;grid-template-columns:2.4rem minmax(0,1fr) auto;min-width:0;align-items:center;gap:.45rem;text-align:left;border:1px solid transparent;border-radius:.22rem;background:#23382f;padding:.22rem .36rem;color:#eee4cc;cursor:pointer}
.merchant-slot[aria-pressed=true]{border-color:#cba96b;background:#3b4937}.merchant-slot:focus-visible{outline:2px solid #f4d497;outline-offset:-2px}
.merchant-slot:disabled{opacity:.68;cursor:default}.merchant-slot strong{font-size:.82rem;line-height:1.15;overflow-wrap:anywhere}
.merchant-icon{width:2.15rem;height:2.15rem;display:grid;place-items:center}.merchant-icon svg{width:100%;height:100%}.merchant-count{color:#dabd84;font-variant-numeric:tabular-nums;font-size:.75rem}
.merchant-selection{margin:.55rem 0;padding:.65rem;border:1px solid #b8965c55;border-radius:.35rem;background:#22342b}
.merchant-order{display:flex;align-items:center;gap:.6rem;flex-wrap:wrap}.merchant-name{flex:1 1 6rem}.merchant-order label{display:flex;align-items:center;gap:.4rem;font-size:.78rem}.merchant-order input{width:3.5rem}
.merchant-bargain,.merchant-news{margin:.5rem 0}.merchant-empty{margin:.5rem .4rem}
.arrival-lessons li{margin:.3rem 0}.arrival-lessons small{display:block;color:#cabfa5}.arrival-lessons .done strong{color:#add4b4}
#swim-readout{background:#193733eb;color:#fff0cb;padding:.28rem .6rem;border-radius:.3rem}
@media(max-width:530px){.merchant-shelves{gap:.3rem}.merchant-shelf header{padding:.42rem}.merchant-slot{grid-template-columns:1.55rem minmax(0,1fr);gap:.2rem;padding:.25rem;position:relative}.merchant-icon{width:1.55rem;height:1.55rem}.merchant-count{grid-column:1;grid-row:2}.merchant-words{grid-column:2;grid-row:1/3}.merchant-order button{min-height:40px}.merchant-slots{padding:.17rem;max-height:13rem}}

#game-panel:has(.merchant-counter) .ledger-town-head,#game-panel:has(.merchant-counter) #tabs{display:none}
#game-panel:has(.merchant-counter) #panel-title{margin:.15rem 0 .45rem}
#game-panel:has(.merchant-counter) .bz-head{border:0;border-bottom:1px solid #b8965c55;background:transparent;padding:.1rem 0 .45rem}
.merchant-directories{padding:.6rem 0;border-top:1px solid #b8965c44}

#quay-chat{position:absolute;left:var(--edge,16px);bottom:calc(var(--lift,16px) + 30px);width:min(365px,35vw);color:#f4ecd9;pointer-events:none;z-index:4;font-size:.79rem}
.quay-chat-lines p{margin:1px 0;padding:2px 6px;background:linear-gradient(90deg,#14241de6,#14241d87 76%,transparent);overflow-wrap:anywhere;text-shadow:0 1px 2px #000}
.quay-chat-lines strong{color:#edcb91}.quay-chat-lines .chat-private strong{color:#e4b0db}.quay-chat-lines .chat-group strong{color:#9fdcdf}
#quay-compose:not([hidden]){display:flex;gap:3px;padding:4px;border:1px solid #b39a6b77;background:#14261ff2;pointer-events:auto}
#quay-compose :is(input,select,button){min-width:0;font:inherit;background:#233a30;color:#faedcb;border:1px solid #69785f;border-radius:3px;padding:.38rem}
#quay-compose input{flex:1}#quay-compose select{max-width:5.2rem}
#hud.talking #quay-chat,#hud:has(#panel-wrap:not([hidden])) #quay-chat,#hud.clean-view #quay-chat{display:none}
@media(pointer:fine) and (min-width:701px){#dialogue{left:var(--edge,16px);transform:none;bottom:calc(var(--lift,16px) + 45px);width:min(480px,46vw)}}
@media(max-width:700px){#quay-chat{left:6px;bottom:calc(var(--lift,16px) + 86px);width:min(67vw,320px)}#quay-chat:not(.writing) .quay-chat-lines p:nth-last-child(n+3){display:none}}

#quay-chat .room-chat-open{display:none}
:is(#voyage,#conflict-room) #quay-chat{bottom:max(96px,calc(env(safe-area-inset-bottom) + 76px));width:min(340px,52vw);z-index:5}
:is(#voyage,#conflict-room) #quay-chat:not(.writing) .room-chat-open{display:inline-block;pointer-events:auto;color:#edcb91;background:#172a24e6;border:1px solid #847654;border-radius:3px;padding:3px 6px}
