.rpg-bag,.rpg-box {
  --bag-line:#c9b991;--bag-paper:#faf5e8;--bag-ink:#263d33;--bag-muted:#5b6155;
  min-width:0;color:var(--bag-ink);font:inherit;
}
.rpg-bag *, .rpg-box * {box-sizing:border-box}
.bag-art {display:block;width:100%;height:100%;pointer-events:none}
.bag-tone-common {--bag-edge:#abc0ac;--bag-wash:#dce7d7;--bag-accent:#487054}
.bag-tone-rare {--bag-edge:#9ab7c8;--bag-wash:#d9e8ed;--bag-accent:#3a6889}
.bag-tone-epic {--bag-edge:#b09ac5;--bag-wash:#e9def0;--bag-accent:#775384}
.bag-tone-legendary {--bag-edge:#d6aa59;--bag-wash:#f5e5bb;--bag-accent:#856022}
.rpg-bag .bag-help,.rpg-bag .bag-reason,.rpg-bag .bag-prompt,.rpg-bag .bag-live,.rpg-box .bag-live {margin:.45rem 0;font-size:.92rem;line-height:1.4;color:var(--bag-muted)}
.rpg-bag .bag-grid {
  display:grid;grid-template-columns:repeat(auto-fill,minmax(min(3.9rem,100%),1fr));gap:.34rem;
  margin:.8rem 0;padding:.48rem;background:#b7a481;border:1px solid #aa956e;border-radius:.53rem;
  box-shadow:inset 0 2px 6px #4f392e30;
}
.rpg-bag .bag-slot,.rpg-box .bag-reel-card,.rpg-bag .bag-detail-art,.rpg-box .bag-reward-picture {
  background:radial-gradient(ellipse at 38% 30%,#fffcf0,var(--bag-wash) 75%);border:1px solid var(--bag-edge);
}
.rpg-bag .bag-slot {
  min-height:0;aspect-ratio:1;display:grid;place-items:center;position:relative;padding:.12rem;margin:0;
  color:var(--bag-ink);border-radius:.3rem;box-shadow:0 1px 2px #4b3b2830;
}
.rpg-bag .bag-filled {cursor:grab}
.rpg-bag .bag-slot.bag-empty {background:linear-gradient(145deg,#c7b89d,#dfd2b8);border:1px solid #a7987e;box-shadow:inset 0 1px 3px #473c2920}
.rpg-bag .bag-empty::after {content:"";width:.32rem;height:.32rem;border:1px solid #ac9e85;transform:rotate(45deg)}
.rpg-bag .bag-slot[aria-pressed=true],.rpg-bag .bag-over {outline:3px solid #2f664f;outline-offset:-3px}
.rpg-bag .bag-slot:focus-visible {outline:3px dashed #613b26;outline-offset:-3px}
.rpg-bag .bag-slot[aria-pressed=true]:focus-visible {outline:3px dashed #144c37}
.rpg-bag .bag-slot:hover {filter:brightness(1.055)}
.rpg-bag .bag-drag {opacity:.55}
.rpg-bag .bag-count,.rpg-bag .bag-pin {position:absolute;font:bold .76rem/1 "Segoe UI",sans-serif;pointer-events:none}
.rpg-bag .bag-count {bottom:.15rem;right:.15rem;padding:.13rem .23rem;border-radius:.2rem;background:#3a4639;color:#fff8e4}
.rpg-bag .bag-pin {top:.13rem;left:.16rem;color:var(--bag-accent);background:#fffaf0;min-width:.86rem;border-radius:50%;text-align:center}
.rpg-bag .bag-detail {margin:.7rem 0;padding:.7rem .8rem;border:1px solid #c9c2a9;border-radius:.42rem;background:#fbf8ee}
.rpg-bag .bag-detail[hidden] {display:none}
.rpg-bag .bag-detail-head {display:flex;align-items:center;gap:.65rem}
.rpg-bag .bag-detail-art {width:3.35rem;height:3.35rem;flex:none;border-radius:.38rem}
.rpg-bag .bag-detail-copy {display:grid;gap:.13rem;min-width:0}
.rpg-bag .bag-detail-title,.rpg-box .bag-reward-title {color:var(--bag-ink);overflow-wrap:anywhere}
.rpg-bag .bag-meta,.rpg-box .bag-reward-rarity {font-size:.88rem;color:var(--bag-muted)}
.rpg-bag .bag-actions {display:flex;flex-wrap:wrap;gap:.4rem;margin-top:.55rem}
.rpg-bag .bag-actions:empty {display:none}
.rpg-bag .bag-button,.rpg-bag .bag-bin,.rpg-box .bag-button {
  color:var(--bag-ink);font:600 .92rem/1.26 "Segoe UI",sans-serif;padding:.5rem .72rem;
  min-height:2.4rem;border:1px solid #a8ad97;border-radius:.32rem;background:#faf8ee;cursor:pointer;
}
.rpg-bag .bag-button:hover,.rpg-box .bag-button:hover {background:#e8edda}
.rpg-bag .bag-bin {width:100%;margin:.3rem 0;border-style:dashed;border-color:#ad8d7e;color:#784938;background:#f6ede3}
.rpg-bag .bag-bin.bag-over {outline-color:#a14d37;background:#f0d7c6}
.rpg-bag .bag-bin:disabled {opacity:.61;cursor:default}
.rpg-bag .bag-danger {background:#8c4234;border-color:#8c4234;color:#fff8ea}
.rpg-bag .bag-danger:hover {background:#6e352c}
.rpg-box .bag-primary {background:#28563f;color:#fff9e9;border-color:#28563f}
.rpg-box .bag-primary:hover {background:#1e4631}
.rpg-bag .bag-live:empty,.rpg-box .bag-live:empty {display:none}
.rpg-bag .bag-live,.rpg-box .bag-live {color:#315c45}
.rpg-bag .bag-error,.rpg-box .bag-error {color:#8e352b}
.rpg-box {text-align:center}
.rpg-box .bag-reel-window {
  position:relative;overflow:hidden;border:1px solid #aa8652;border-radius:.5rem;padding:.68rem 0;
  background:linear-gradient(#293d34,#5b6850 45%,#314237);isolation:isolate;
}
.rpg-box .bag-reel-window::before {content:"";position:absolute;z-index:1;inset:0;pointer-events:none;box-shadow:inset 11px 0 12px -8px #183326,inset -11px 0 12px -8px #183326}
.rpg-box .bag-reel-window::after {
  content:"";position:absolute;z-index:2;left:50%;top:0;transform:translateX(-50%);
  width:0;height:0;border-left:.48rem solid transparent;border-right:.48rem solid transparent;border-top:.65rem solid #f8cf78;
}
.rpg-box .bag-reel {display:flex;position:relative;width:max-content;gap:.35rem;will-change:transform}
.rpg-box .bag-reel-card {display:block;width:3.8rem;height:3.8rem;border-radius:.28rem;flex:none}
.rpg-box .bag-skip {margin:.65rem 0}
.rpg-box .bag-reward {padding:.7rem 0;display:grid;justify-items:center;gap:.18rem}
.rpg-box .bag-reward-picture {width:7.8rem;height:7.8rem;border-radius:50%;box-shadow:inset 0 0 0 .27rem #ffffff50}
.rpg-box .bag-reward-rarity {margin:.2rem 0 0}
.rpg-box .bag-reward-title {font:600 1.4rem/1.2 Georgia,serif;margin:0 0 .55rem}
.rpg-box.bag-revealed .bag-reel {will-change:auto}
@media(max-width:420px) {
  .rpg-bag .bag-grid {grid-template-columns:repeat(auto-fill,minmax(min(3.25rem,100%),1fr))}
}

.coin-amount{display:inline-flex;align-items:center;gap:.32em;white-space:nowrap;vertical-align:middle;line-height:1.1}
.coin-amount img{display:block;width:1.28em;height:1.28em;flex:none;filter:drop-shadow(0 1px 1px #70400742)}
.coin-amount strong{font:800 1em/1.1 "Segoe UI",sans-serif;font-variant-numeric:tabular-nums;letter-spacing:-.025em}
.coin-unit{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.room-hud{display:flex;align-items:flex-start;gap:8px;min-width:0}
.room-hud .place{min-width:0;overflow-wrap:anywhere}
.head-buttons{flex:none;max-width:calc(100% - 14rem);flex-wrap:wrap;justify-content:flex-end;align-content:flex-start}
.head-buttons button{flex:none;white-space:nowrap}
.wallet-badge{display:inline-flex;flex-direction:column;align-items:flex-start;gap:2px;color:#433423;vertical-align:middle;text-transform:none;letter-spacing:normal}
.wallet-label{color:#75624a;font-size:.71rem;font-weight:650;letter-spacing:.035em}
.wallet-badge .coin-amount{font-size:1.32rem}
#hud-wallet{border:1px solid #96835986;background:#1c3025f5;border-radius:10px;padding:6px 13px 8px;box-shadow:0 3px 12px #08130b47}
#hud-wallet .wallet-label{color:#dfcfad}#hud-wallet .coin-amount{color:#fff3cb}
#panel:is([data-view="shop"],[data-view="bag"],[data-view="gifts"])>header>div{flex:1;display:flex;flex-direction:row-reverse;align-items:center;justify-content:space-between;gap:12px}
#panel:is([data-view="shop"],[data-view="bag"],[data-view="gifts"])>header{align-items:center}
#panel[data-view="gifts"]{width:min(485px,calc(100% - 30px))}
.inventory-tabs{display:flex;gap:4px;padding:4px;background:#e6dfce;border:1px solid #d5cbb6;border-radius:8px;margin:2px 0 12px;flex:none}
.inventory-tabs button{border:0;background:transparent;color:#4f5246;flex:1;min-width:0;padding:8px 4px;font-size:.95rem;font-weight:650;border-radius:5px}
.inventory-tabs button[aria-selected="true"]{color:#fff6df;background:#31533f;box-shadow:0 1px 3px #1c412533}
.stock-pocket{border:1px solid #c9b99a;background:#f2ebdb;color:#4e4532;border-radius:6px;padding:7px 12px;font-weight:650;margin:5px 0}
.gift-pocket{margin-top:11px}.stock-pocket:hover{background:#e8ddc6}
#panel[data-view="chest"]{width:min(730px,calc(100% - 28px));padding:16px;left:0;right:0;margin-inline:auto}
#panel[data-view="chest"]>header{margin-bottom:12px}
#panel[data-view="chest"] #panel-error:empty{display:none}
.chest-board{display:grid;grid-template-columns:minmax(0,1fr) 64px minmax(0,1fr);gap:10px;align-items:stretch}
.chest-pane{--pane-ink:#473723;--pane-fill:#dfd0b1;min-width:0;display:flex;flex-direction:column;overflow:hidden;border:1px solid #afa080;border-radius:8px;background:#f1e8d6}
.chest-pane[data-side="carried"]{--pane-ink:#2c4638;--pane-fill:#c9d2bc;background:#e8eddf;border-color:#a4b09b}
.chest-pane-head{display:flex;align-items:center;gap:7px;min-height:38px;padding:6px 10px;background:var(--pane-ink);color:#fff3d4}
.chest-pane-head svg{width:23px;height:23px;flex:none;fill:none;stroke:#e6c58e;stroke-width:1.55;stroke-linecap:round;stroke-linejoin:round}
#panel .chest-pane-head h3{margin:0;color:inherit;font:600 1.15rem/1.1 Georgia,serif}
.chest-total{margin-left:auto;font-size:.78rem;color:#efe4cc;white-space:nowrap;font-variant-numeric:tabular-nums}
.chest-cells{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:5px;align-content:start;flex:1;min-height:0;max-height:clamp(120px,40dvh,330px);overflow-y:auto;overscroll-behavior:contain;overflow-anchor:none;padding:8px;background:var(--pane-fill);scrollbar-width:thin}
.chest-exchange .bag-slot{width:100%;user-select:none;-webkit-touch-callout:none}
.chest-exchange .bag-filled{touch-action:pan-y}
.chest-exchange .bag-filled:after{content:'';position:absolute;inset:auto 12% 2px;height:2px;background:var(--bag-accent);opacity:.65;border-radius:3px;pointer-events:none}
.chest-exchange .bag-empty{cursor:default}
.chest-exchange .bag-count{z-index:1}
.chest-choice{display:flex;align-items:center;justify-content:space-between;gap:5px;min-height:55px;padding:7px 9px;border-top:1px solid #a798785e}
.chest-copy{display:grid;gap:3px;min-width:0}.chest-copy strong{font:600 .94rem/1.1 Georgia,serif;color:#273d31}
.chest-copy small{color:#545e51;font-size:.72rem;line-height:1.2}
.chest-units{display:grid;gap:1px;flex:none;margin:0;font-size:.66rem;color:#4f5547}
.chest-units input{width:3.3rem;min-width:0;padding:4px 2px 4px 5px;margin:0;border:1px solid #afa48e;border-radius:4px;background:#fffaf0;color:#25382b;font:600 .87rem/1.2 system-ui}
.chest-units[hidden]{display:none}
.chest-actions{display:flex;flex-direction:column;align-self:center;gap:10px}
.chest-move{width:100%;display:grid;justify-items:center;gap:2px;padding:6px 1px;border:1px solid #3e5946;border-radius:6px;background:#345541;color:#fff4d6;font:600 .74rem/1.2 system-ui}
.chest-move:first-child{border-color:#70543b;background:#70543b}
.chest-move:enabled:hover{filter:brightness(1.13)}.chest-move:disabled{opacity:.42}
.chest-arrow{font:500 1.55rem/1 system-ui}.chest-move:focus-visible{outline:2px solid #2e5e77;outline-offset:2px}
#panel .chest-help,#panel .chest-status{font-size:.84rem;line-height:1.35;margin:9px 0 0;color:#505d50}
#panel .chest-status{color:#31523a;font-weight:600}.chest-status:empty{display:none}
.chest-receiving{outline:2px solid #927139;outline-offset:1px}.chest-exchange .chest-lift{opacity:.55}
.chest-exchange .bag-slot.chest-over{outline:3px solid #2b7550;outline-offset:-3px}
.chest-exchange .bag-slot.chest-blocked{outline:3px dashed #aa5141;outline-offset:-3px}
.chest-ghost{position:fixed;top:0;left:0;z-index:100;pointer-events:none;width:50px;height:50px;background:var(--bag-wash);border:2px solid var(--bag-accent);border-radius:8px;box-shadow:0 6px 15px #1a251b55;opacity:.92}
@media(max-width:600px){
  #panel[data-view="chest"]{width:calc(100% - 12px);padding:10px}
  .chest-board{grid-template-columns:minmax(0,1fr) 51px minmax(0,1fr);gap:5px}
  .chest-cells{grid-template-columns:repeat(3,minmax(0,1fr));gap:3px;padding:4px}
  .chest-choice{flex-wrap:wrap;align-content:start;padding:6px;min-height:67px}
  .chest-units{display:flex;align-items:center;gap:4px}
  .chest-pane-head{gap:4px;padding:5px}.chest-pane-head svg{width:17px}
  #panel .chest-pane-head h3{font-size:1rem}.chest-total{font-size:.68rem}
  .chest-move{font-size:.66rem;min-height:45px}
}
@media(max-width:440px){.chest-cells{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(orientation:landscape) and (max-height:550px){
  #panel[data-view="chest"]{padding:9px 12px}
  #panel[data-view="chest"]>header{margin-bottom:6px}
  .chest-cells{grid-template-columns:repeat(5,minmax(0,1fr));max-height:calc(100dvh - 180px)}
  .chest-choice{min-height:43px}.chest-pane-head{min-height:30px}
}
#panel[data-view="shop"]:has(.shop-shell){display:flex;flex-direction:column;height:min(650px,calc(100% - 168px));overflow:clip}
#panel[data-view="shop"]:has(.shop-shell)>header{flex:none}
#panel[data-view="shop"] #panel-body,.shop-shell{min-height:0;display:flex;flex-direction:column;flex:1}
.merchant-caption{flex:none;margin:.1rem 0 .65rem;padding:.38rem .75rem;border-inline-start:3px solid #c99d58;background:rgba(95,107,79,.16);line-height:1.35}
@media(max-height:500px){.merchant-caption{margin:0 0 .25rem;padding:.16rem .55rem;font-size:.81rem}}
.shop-shell>.inventory-page{min-height:0;overflow-y:auto;overscroll-behavior:contain;overflow-anchor:none;scrollbar-gutter:stable;flex:1;padding:0 3px 5px 0}
.stock-row{display:grid;grid-template-columns:50px minmax(0,1fr) auto;align-items:center;gap:12px;padding:10px 0;border-bottom:1px solid #ddd4c1}
.stock-picture{width:50px;height:50px;border:1px solid var(--bag-edge);border-radius:7px;background:radial-gradient(at 25% 15%,#fffdf3,var(--bag-wash))}
.stock-copy{display:grid;gap:3px}.stock-name{font:600 1.03rem/1.16 Georgia,serif;color:#304536}
.stock-tier,.stock-info,.stock-count{color:#625e50;font-size:.79rem;line-height:1.36}.stock-tier{font-weight:700;color:#86653c}
.trade-button{display:inline-flex;align-items:center;justify-content:center;gap:9px;min-height:40px;padding:6px 9px;border:1px solid #c4b391;border-radius:6px;background:#f3e7cf;color:#473a27}
.trade-button:hover:enabled{background:#ebd9b6}.trade-button .coin-amount{font-size:1.02rem}.trade-verb{font-size:.82rem;font-weight:650}
.stock-clothes summary{padding:9px 0}
#panel .shop-empty{color:#596454;padding:14px 0}
@media(max-width:680px){
  .game-head{display:grid;grid-template-columns:1fr;gap:5px}
  .room-hud{align-items:center;justify-content:space-between;gap:8px}
  .game-head .place{max-width:calc(100% - 92px);padding:4px 8px}
  .game-head .place h1{line-height:1.04}.game-head #session-info{display:block;line-height:1.3}
  .game-head .head-buttons{max-width:none;min-width:0}
  #hud-wallet{padding:5px 8px;border-radius:6px}
  #hud-wallet .wallet-badge{flex-direction:row;align-items:center;gap:6px}#hud-wallet .coin-amount{font-size:1rem}
  #panel[data-view="shop"]:has(.shop-shell){top:90px;height:calc(100% - 153px)}
  #panel[data-view="gifts"]{width:calc(100% - 14px)}
}
@media(max-width:440px){
  .stock-row{grid-template-columns:39px minmax(0,1fr) auto;gap:7px}.stock-picture{width:39px;height:39px}
  .trade-button{flex-direction:column;gap:2px;min-width:64px}.trade-button .trade-verb{font-size:.74rem}
  #panel:is([data-view="shop"],[data-view="bag"],[data-view="gifts"]) h2{font-size:1.4rem}
}
#room-sound {display:inline-grid;place-items:center;min-width:32px;padding-inline:6px}
#room-sound[aria-pressed="true"] .silent, #room-sound[aria-pressed="false"] .waves {display:none}
.shop-shell>.shop-sales {overflow:hidden;display:flex;flex-direction:column}
.shop-sales>.inventory-page {overflow-y:auto;min-height:0;overscroll-behavior:contain;overflow-anchor:none;scrollbar-gutter:stable}
.shop-sales>.inventory-tabs {flex:none}
@media (orientation:landscape) and (max-height:550px){
  #game #panel[data-view="shop"]:has(.shop-shell){height:calc(100dvh - 8px);padding:8px 12px}
  #panel[data-view="shop"]>header{margin-bottom:5px}
  #panel[data-view="shop"] .inventory-tabs{margin:2px 0;padding:2px}
  #panel[data-view="shop"] .shop-sales>.inventory-page{flex:1 1 0}
}
.shop-sales .sale-confirm {display:grid;justify-items:center;gap:3px}
.rpg-box .reward-actions {display:flex;flex-wrap:wrap;justify-content:center;gap:8px;margin-top:8px}
.catalog-filters {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.45rem;margin:.75rem 0}
.catalog-filters input {grid-column:1/-1}
.catalog-filters input,.catalog-filters select {min-width:0;width:100%;padding:.4rem;border:1px solid #b5b39a;border-radius:.3rem;background:#fffdf6;color:#293d32}
.catalog-count {grid-column:1/-1;color:#586454}
.equipped-gear {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.45rem;margin:.7rem 0}
.equipped-slot {display:grid;justify-items:start;gap:.22rem;align-content:start;padding:.55rem .65rem;background:#f8f3e7;border:1px solid #ccc6af;border-radius:.35rem;color:#374739}
.equipped-slot small,.equipped-slot span {font-size:.77rem}
.equipped-slot .bag-art {width:3.3rem;height:3.3rem}
.equipped-slot strong {font-size:.9rem;overflow-wrap:anywhere}
.rpg-bag .bag-slot.bound-relic {background:radial-gradient(ellipse at 42% 25%,#fff5cd,#dbb669 90%);border:2px solid #9a712d;box-shadow:inset 0 0 0 1px #fff2bd}
.season-relics {display:grid;gap:.45rem}
.relic-card {display:grid;grid-template-columns:clamp(3.75rem,15vw,5.75rem) 1fr;align-items:center;gap:.65rem;padding:.7rem .8rem;border-radius:.45rem;background:linear-gradient(115deg,#203f3b,#2c4640);border:1px solid #8e783e;color:#fff4d2}
.relic-card>.bag-art {width:100%;height:auto;background:radial-gradient(ellipse,#f8eaca,#b38d50);border-radius:.35rem}
.relic-card small,.relic-card span {display:block;color:#ecd390;font-size:.74rem;line-height:1.35}
.relic-card strong {display:block;margin:.2rem 0;color:#ffedc5;font:600 1.15rem/1.14 Georgia,serif}
#panel .relic-card p {margin:.3rem 0 .45rem;font-size:.88rem;line-height:1.35;color:#fff6e2}
.bag-detail .relic-story {font:italic .92rem/1.4 Georgia,serif;color:#5a5039}
#panel[data-view="lookbook"] {width:min(580px,calc(100% - 24px))}
.wardrobe-gallery {color:#273b30}
.garment-preview {border:1px solid #c5b794;border-radius:.5rem;padding:.7rem;background:#f6efdb}
.garment-heading {display:flex;align-items:baseline;justify-content:space-between;gap:.45rem;flex-wrap:wrap}
.garment-heading strong {font:600 1.18rem/1.2 Georgia,serif}
.garment-heading span,.garment-swatch figcaption {color:#52634f;font-size:.81rem}
.garment-versions {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.5rem;margin-top:.55rem}
.garment-swatch {margin:0;text-align:center}
.garment-swatch .bag-art {height:clamp(4rem,11vw,6.2rem)}
.garment-shelf {display:grid;grid-template-columns:repeat(auto-fill,minmax(5.5rem,1fr));gap:.4rem;margin-top:.7rem}
.garment-card {display:grid;grid-template-rows:3.85rem auto;align-content:start;justify-items:center;gap:.12rem;padding:.28rem .3rem .4rem;color:#343e32;background:#fbf6ea;border:1px solid #c8bca0;border-bottom:3px solid var(--bag-accent,#aa9679);border-radius:.35rem}
.garment-card[aria-pressed="true"] {outline:2px solid #3c674b;outline-offset:-2px;background:#edf2dc}
.garment-card span {font:600 .76rem/1.16 system-ui;overflow-wrap:anywhere}
.bag-condition-bars {position:absolute;bottom:.18rem;left:.2rem;display:flex;align-items:flex-end;gap:2px;background:#fff9e9de;padding:2px;border-radius:2px;pointer-events:none}
.bag-condition-bars i {width:3px;height:4px;background:#397057}
.bag-condition-bars i:nth-child(2) {height:6px}
.bag-condition-bars i:nth-child(3) {height:8px}
[data-condition="worn"] .bag-condition-bars i {background:#886123}
[data-condition="tattered"] .bag-condition-bars i {background:#915045}
[data-condition="worn"] .bag-condition-bars i:nth-child(3),[data-condition="tattered"] .bag-condition-bars i:nth-child(n+2) {background:#c9c4b8}
