:is(#merchantPanel,#merchantDetails){box-sizing:border-box;width:64vw;max-width:1200px;height:64vh;max-height:760px;min-height:450px;margin:auto;padding:30px 36px 25px;border:1px solid #c5a770;border-radius:3px;color:#ecdfc5;background:linear-gradient(130deg,#382f24f7,#211f19fc);box-shadow:0 25px 90px #090e10a0,inset 0 0 0 7px #d5b7760c;overflow:auto;font-family:var(--sans)}:is(#merchantPanel,#merchantDetails)::backdrop{background:#0c1417a6;backdrop-filter:blur(2px)}:is(#merchantPanel,#merchantDetails) h2{font:38px var(--serif);letter-spacing:6px;margin:9px 0;color:#f3deaf}:is(#merchantPanel,#merchantDetails) h2 span{padding:0 9px;color:#bb9560}.merchant-kicker{font-size:10px;letter-spacing:3px;color:#c9ae7c}.merchant-close{position:absolute;right:17px;top:15px;width:36px;height:36px;border:1px solid #b8976159;color:#e3cfaa;background:#e3c88808;font-size:24px}.merchant-subtitle{font-size:12px;letter-spacing:1px;color:#cabea5;margin:0 0 14px}.merchant-brief-body{display:grid;grid-template-columns:25% 1fr;gap:24px;border-top:1px solid #c6a56740;border-bottom:1px solid #c6a56740;padding:20px 0}.merchant-vessels{position:relative;display:flex;align-items:center;justify-content:center;background:radial-gradient(ellipse,#b4945430,transparent 72%);min-height:146px}.merchant-vessels img{width:42%;height:135px;object-fit:contain;filter:drop-shadow(0 8px 8px #0006);position:absolute;left:2%;bottom:30px;transform:rotate(-9deg)}.merchant-vessels img:nth-child(2){width:52%;height:169px;left:28%;bottom:26px;transform:rotate(4deg)}.merchant-vessels img:nth-child(3){left:62%;width:44%;height:95px;bottom:22px;transform:rotate(8deg)}.merchant-vessels>span{position:absolute;bottom:0;font-size:9px;letter-spacing:2px;color:#c8b98e;white-space:nowrap}.merchant-rules h3{font:20px var(--serif);letter-spacing:2px;color:#ead4a5;margin:0 0 8px}.merchant-rules p{font-size:12px;line-height:1.9;margin:5px 0 9px}.merchant-rules strong{font-weight:400;color:#efd09a}.merchant-skill-line{display:flex;border-top:1px solid #ad8c5740;margin-top:13px;padding-top:13px;gap:19px}.merchant-skill-line>span{font-family:var(--serif);color:#dfc69a;font-size:14px;white-space:nowrap}.merchant-skill-line small{display:block;font:10px var(--sans);color:#b8b3a5;margin-top:5px}.merchant-promise{font-size:11px;color:#bca983;letter-spacing:1px;margin:13px 0}.merchant-actions{display:flex;align-items:center;gap:10px;margin-top:15px}:is(#merchantPanel,#merchantDetails) button:not(.merchant-close),#merchantMilestone button{border:1px solid #b69b686e;background:#b59b7010;color:#e2d3b2;min-height:42px;padding:10px 18px;font-size:12px;border-radius:2px}:is(#merchantPanel,#merchantDetails) .merchant-primary{background:#d6bd87!important;color:#352c20!important;border-color:#e3cd9e!important;margin-left:auto;min-width:175px;font-size:15px!important;letter-spacing:2px}.merchant-primary span{margin-left:20px}:is(#merchantPanel,#merchantDetails) button:hover,#merchantMilestone button:hover{background:#d8bd8426;box-shadow:inset 0 0 0 1px #dcc29180}:is(#merchantPanel,#merchantDetails) button:focus-visible,#merchantMilestone button:focus-visible{outline:2px solid #f4d9a0;outline-offset:3px}:is(#merchantPanel,#merchantDetails) button:active{transform:translateY(1px)}#merchantDetails{width:49vw;height:auto;min-height:380px;max-height:78vh}.merchant-detail h3{font:19px var(--serif);margin:19px 0 8px;color:#e6c58d}.merchant-detail p{font-size:13px;line-height:1.9}.merchant-muted{color:#b9ac91}.merchant-volume{padding:30px 0}.merchant-volume label{display:flex;justify-content:space-between;font:20px var(--serif);color:#e4cfac}.merchant-volume input{width:100%;accent-color:#d8bb83;height:34px;margin:18px 0 5px}.merchant-volume p{font-size:12px;color:#bdae92}#banquetGameRoot{position:absolute;inset:0;z-index:30;background:#ece0c7}.banquet-frame{display:block;width:100%;height:100%;border:0;background:#f6efdf}#merchantReceipt{position:absolute;z-index:5;left:68%;top:47%;width:min(390px,31vw);margin:0;transform:translate(-50%,-50%);pointer-events:none;filter:drop-shadow(0 15px 22px #0a0c1080)}#merchantReceipt img{width:100%;display:block}#merchantReceipt figcaption{display:flex;justify-content:space-between;font:16px var(--serif);letter-spacing:3px;padding:8px 16px;color:#f1d6a4;background:#292922da;border:1px solid #b79a6580}#merchantReceipt figcaption span{font:10px var(--sans);letter-spacing:2px;align-self:center}#merchantReceipt.reveal{animation:receipt-reveal 6.2s ease both}#merchantMilestone{position:absolute;left:8%;right:8%;bottom:40px;z-index:7;padding:25px 30px;background:linear-gradient(105deg,#283831ee,#25332bf5);border-top:1px solid #c6aa71;color:#ead9b5}#merchantMilestone small{font-size:10px;letter-spacing:4px;color:#c9b286}#merchantMilestone h2{font:30px var(--serif);letter-spacing:4px;margin:10px 0}#merchantMilestone p{font-size:13px;color:#c4c7b6;margin-bottom:16px}#chapterRoot[data-market=true] .chapter-objective{top:108px}#chapterRoot[data-market=true] .chapter-brand small{color:#d5b984}#chapterDialogue[data-long=true] #chapterText{font-size:clamp(19px,1.55vw,24px);line-height:1.7;letter-spacing:.8px}#chapterDialogue[data-long=true]{bottom:25px}#chapterRoot[data-banquet=true] .chapter-topbar{visibility:hidden}.merchant-note-image{display:block;width:260px;max-width:100%;margin:16px auto}.merchant-clue-note{line-height:1.9;color:#655039}.merchant-clue-note strong{font-family:var(--serif);font-size:20px}
@keyframes receipt-reveal{0%{opacity:0;transform:translate(-50%,calc(-50% + 45px)) scale(.82) rotate(-3deg)}18%{opacity:1;transform:translate(-50%,-50%) scale(1) rotate(-2deg)}45%,82%{opacity:1;transform:translate(-50%,-50%) scale(1.07) rotate(-1deg)}100%{opacity:0;transform:translate(-50%,calc(-50% - 10px)) scale(1.04)}}
@media(max-height:820px){#merchantPanel{width:66vw;height:67vh;padding:24px 30px 22px}#merchantPanel h2{font-size:34px;margin:7px 0}.merchant-brief-body{grid-template-columns:22% 1fr;gap:20px;padding:15px 0}.merchant-subtitle{margin-bottom:12px}.merchant-promise{margin:10px 0}.merchant-actions{margin-top:12px}}
@media(min-height:900px){:is(#merchantPanel,#merchantDetails){padding:45px 52px;display:flex;flex-direction:column}:is(#merchantPanel,#merchantDetails):not([open]){display:none}:is(#merchantPanel,#merchantDetails) h2{font-size:48px;margin:15px 0}.merchant-subtitle{font-size:14px;margin-bottom:24px}.merchant-brief-body{flex:1;align-items:center;gap:30px;padding:26px 0}.merchant-rules p{font-size:15px;line-height:2}.merchant-rules h3{font-size:26px}.merchant-skill-line{padding-top:20px;margin-top:20px;gap:24px}.merchant-skill-line>span{font-size:18px}.merchant-skill-line small{font-size:12px}.merchant-vessels{height:235px}.merchant-vessels img{height:190px}.merchant-vessels img:nth-child(2){height:240px}.merchant-vessels img:nth-child(3){height:145px}.merchant-promise{font-size:13px;margin-top:23px}.merchant-actions{margin-top:20px}:is(#merchantPanel,#merchantDetails) button:not(.merchant-close){min-height:49px;font-size:14px}#merchantReceipt{width:470px}}
@media(prefers-reduced-motion:reduce){#merchantReceipt.reveal{animation:none;transform:translate(-50%,-50%)}}

/* A framed play surface over the actual merchant stall. */
#banquetGameRoot{background:#201a12a8;backdrop-filter:blur(3px)}
.banquet-frame{background:transparent}

/* Textured book leaves: repeat grain at a fixed scale and preserve the ink art. */
:is(#merchantPanel,#merchantDetails).merchant-book{
  --merchant-ink:#35443f;--merchant-muted:#726959;--merchant-rule:#7f79614d;
  --merchant-cover-texture:url('assets/ui/merchant-paper/orange-weave.png');
  --merchant-cover-edge:#b57b4e;--merchant-cover-inset:#efb985;--merchant-cover-inset-edge:#b67845;
  position:fixed;box-sizing:border-box;width:min(1120px,88vw);max-width:1120px;
  height:fit-content;min-height:0;max-height:calc(100svh - 28px);margin:auto;padding:20px 72px 34px 18px;
  border:0;border-radius:0;background:transparent;outline:0;box-shadow:none;
  overflow:visible;font-family:var(--sans);isolation:isolate;
}
.merchant-book .merchant-book-sheet{
  position:relative;z-index:1;box-sizing:border-box;max-height:calc(100svh - 112px);
  padding:28px 36px 26px;overflow:auto;
  border:12px solid transparent;border-radius:1px;outline:1px solid var(--merchant-cover-edge,#283940);outline-offset:1px;
  background-image:url('assets/ui/merchant-paper/paper-grain.png'),url('assets/ui/merchant-paper/ink-landscape.svg'),linear-gradient(115deg,#f0ebdf,#e7dfcd),var(--merchant-cover-texture,url('assets/ui/merchant-paper/indigo-weave.png'));
  background-size:256px 256px,cover,auto,128px 128px;
  background-origin:padding-box,padding-box,padding-box,border-box;
  background-clip:padding-box,padding-box,padding-box,border-box;
  background-repeat:repeat,no-repeat,no-repeat,repeat;
  color:var(--merchant-ink);box-shadow:0 25px 75px #0b151a8a,inset 0 0 0 1px #b8a58a;
}
:is(#merchantPanel,#merchantDetails).merchant-book[open]{display:block}
:is(#merchantPanel,#merchantDetails).merchant-book::before{content:none}
.merchant-book .merchant-book-sheet::before{
  content:"";position:absolute;inset:7px;pointer-events:none;border:1px solid #6f705963;
}
:is(#merchantPanel,#merchantDetails).merchant-book::backdrop{background:#14232487;backdrop-filter:blur(4px)}
.merchant-book .merchant-book-heading{display:flex;justify-content:space-between;align-items:center;gap:28px;padding-right:34px}
.merchant-book-layers{position:absolute;inset:0;z-index:0;pointer-events:none}
.merchant-book-layers i{position:absolute;display:block;box-sizing:border-box}
.merchant-back-paper{
  inset:21px 74px 22px 16px;transform:rotate(-3.2deg);border:1px solid #8c8168;
  background:url('assets/ui/merchant-paper/paper-grain.png') 0 0/256px 256px repeat,#ddd2b8;
  box-shadow:0 4px 10px #0b151a4d,inset 0 0 0 6px #e9dfc780,inset 0 0 0 7px #a4997a80;
}
.merchant-back-book{
  top:9px;right:22px;bottom:28px;width:25%;transform:rotate(6deg);
  border:1px solid var(--merchant-cover-edge,#1e303a);background:var(--merchant-cover-texture,url('assets/ui/merchant-paper/indigo-weave.png')) 0 0/128px 128px repeat;
  box-shadow:inset 0 0 0 3px var(--merchant-cover-inset,#4b6068),inset 0 0 0 4px var(--merchant-cover-inset-edge,#1d323f),4px 7px 12px #0b151a5e;
}
.merchant-back-book::before{content:"";position:absolute;top:8px;bottom:8px;right:22px;width:1px;background:#ddcfb6a6}
.merchant-back-book::after{content:"";position:absolute;top:25px;bottom:20px;right:1px;width:22px;background:repeating-linear-gradient(180deg,transparent 0 69px,#ddcfb699 69px 70px,transparent 70px 100px)}
.merchant-back-book>span{position:absolute;top:26px;left:23px;padding:12px 7px;border:3px double #beb7a2;background:#e6dfcb;color:#44514b;writing-mode:vertical-rl;font:17px/1.3 var(--serif);letter-spacing:6px;font-style:normal}
.merchant-book .merchant-kicker{font:12px/1.5 var(--serif);letter-spacing:2.5px;color:#726248}
:is(#merchantPanel,#merchantDetails).merchant-book h2{font:44px/1.25 var(--serif);font-weight:400;letter-spacing:6px;color:#304840;margin:8px 0 6px}
:is(#merchantPanel,#merchantDetails).merchant-book h2 span{padding:0 7px;color:#94604c}
.merchant-book .merchant-book-seal{flex-shrink:0;width:68px;height:73px;padding:0;border:0;background:url('assets/ui/merchant-paper/orchid-seal.png') center/contain no-repeat;box-shadow:none;transform:none}
.merchant-book .merchant-subtitle{font:16px/1.6 var(--serif);letter-spacing:1px;color:#6b6556;margin:3px 0 16px}
.merchant-book .merchant-brief-body{grid-template-columns:28% 1fr;align-items:center;gap:30px;min-height:240px;padding:23px 0;border-color:var(--merchant-rule);flex:none}
.merchant-book .merchant-vessels{min-height:240px;height:100%;background:none}
.merchant-book .merchant-vessels::before{content:"";position:absolute;width:190px;height:190px;left:50%;top:45%;transform:translate(-50%,-50%);border:1px solid #637a632e;border-radius:50%;box-shadow:0 0 0 7px #637a6308,0 0 0 8px #637a6314;background:radial-gradient(ellipse,#c5c9ae55,transparent 72%)}
.merchant-book .merchant-vessels img{width:43%;height:155px;left:0;bottom:43px;filter:drop-shadow(2px 7px 5px #615c3e25)}
.merchant-book .merchant-vessels img:nth-child(2){width:54%;height:210px;left:24%;bottom:35px}
.merchant-book .merchant-vessels img:nth-child(3){width:47%;height:125px;left:58%;bottom:32px}
.merchant-book .merchant-vessels>span{bottom:0;color:#796c52;font:13px/1.5 var(--serif);letter-spacing:2px}
.merchant-book .merchant-rules h3{font:25px/1.45 var(--serif);letter-spacing:2px;color:#3a4f43;margin:0 0 10px}
.merchant-book .merchant-rules p{font-size:16px;line-height:1.85;color:#514f43;margin:7px 0 11px}
.merchant-book .merchant-rules strong{font-weight:600;color:#984f3d}
.merchant-book .merchant-skill-line{display:grid;grid-template-columns:repeat(3,1fr);gap:16px;border:0;margin-top:18px;padding-top:0}
.merchant-book .merchant-skill-line>span{font:18px/1.4 var(--serif);color:#516b58;border-left:2px solid #74856a66;padding-left:12px;white-space:normal}
.merchant-book .merchant-skill-line small{font:12px/1.6 var(--sans);color:#79705e;margin-top:5px}
.merchant-book .merchant-promise{font:14px/1.6 var(--serif);color:#746047;letter-spacing:1px;margin:16px 0}
.merchant-book .merchant-actions{gap:12px;margin-top:18px}
:is(#merchantPanel,#merchantDetails).merchant-book button:not(.merchant-close){min-height:46px;padding:11px 22px;border:1px solid #68746799;border-radius:1px;background-image:url('assets/ui/merchant-paper/paper-grain.png'),linear-gradient(105deg,#f7f0dfb3,#e5e5cf80);background-size:256px 256px,auto;color:#3d574b;box-shadow:inset 0 0 0 3px #f5f0e1,inset 0 0 0 4px #85927d66;font:16px/1.4 var(--serif);letter-spacing:1px}
:is(#merchantPanel,#merchantDetails).merchant-book .merchant-primary{min-width:194px;color:#fff3df!important;border-color:#6d3b32!important;background:#914e40 url('assets/ui/merchant-paper/paper-grain.png') repeat!important;background-size:256px 256px!important;box-shadow:inset 0 0 0 3px #914e40,inset 0 0 0 4px #e9cab178;font-size:18px!important;font-weight:400}
:is(#merchantPanel,#merchantDetails).merchant-book button:hover{filter:brightness(.97);box-shadow:inset 0 0 0 3px #eee9d9,inset 0 0 0 4px #5b786b99}
:is(#merchantPanel,#merchantDetails).merchant-book .merchant-primary:hover{filter:brightness(1.08);box-shadow:inset 0 0 0 3px #914e40,inset 0 0 0 4px #efd8b1a6}
:is(#merchantPanel,#merchantDetails).merchant-book button:focus-visible{outline:2px solid #526b60;outline-offset:4px}
.merchant-book .merchant-close{top:18px;right:18px;width:32px;height:32px;border:1px solid #7d7b655c;color:#5e6150;background:#eeeadc80;font:24px/1 var(--sans);padding:0;box-shadow:none}
#merchantDetails.merchant-book{width:min(900px,84vw);max-width:900px}
#merchantDetails .merchant-book-sheet{padding:24px 32px}
.merchant-book .merchant-detail{padding-top:4px}
.merchant-book .merchant-detail h3{font:23px/1.45 var(--serif);color:#42604e;margin:18px 0 7px}
.merchant-book .merchant-detail p{font-size:16px;line-height:1.85;color:#555044;margin:7px 0}
.merchant-book .merchant-detail .merchant-muted{font-size:14px;color:#7b705b}
.merchant-book .merchant-volume{padding:26px 0 12px}
.merchant-book .merchant-volume label{font:23px/1.5 var(--serif);color:#465c4d}
.merchant-book .merchant-volume output{font:20px/1.5 Georgia,serif;color:#8e503e}
.merchant-book .merchant-volume input{accent-color:#5d7866;margin:18px 0 7px}
.merchant-book .merchant-volume p{font-size:15px;color:#726550}
@media(max-height:780px){
  .merchant-book .merchant-book-sheet{padding:23px 30px 22px}
  :is(#merchantPanel,#merchantDetails).merchant-book h2{font-size:38px}
  .merchant-book .merchant-brief-body{padding:18px 0;gap:24px;min-height:220px}
  .merchant-book .merchant-vessels{min-height:220px}
  .merchant-book .merchant-vessels img:nth-child(2){height:190px}
  .merchant-book .merchant-rules h3{font-size:23px}
  .merchant-book .merchant-rules p{font-size:15px}
  .merchant-book .merchant-skill-line{margin-top:13px;gap:12px}
  .merchant-book .merchant-skill-line>span{font-size:17px}
  .merchant-book .merchant-promise{margin:12px 0}
  .merchant-book .merchant-actions{margin-top:14px}
}

/* Keep all six illustrated rules and their acknowledgment on one desktop page. */
#merchantDetails.merchant-book[data-guide=true]{
  top:clamp(14px,3svh,28px);bottom:auto;margin:0 auto;
  padding:16px 72px 26px 18px;max-height:calc(100svh - 28px);
}
#merchantDetails.merchant-book[data-guide=true] .merchant-book-sheet{max-height:calc(100svh - 88px);padding:16px 26px 18px}
#merchantDetails.merchant-book[data-guide=true] .merchant-book-heading{gap:16px;margin-bottom:10px}
#merchantDetails[data-guide=true] .merchant-book-seal{width:44px;height:48px}
#merchantDetails.merchant-book[data-guide=true] h2{font-size:30px;margin:0}
#merchantDetails[data-guide=true] .banquet-guide{gap:12px}
#merchantDetails[data-guide=true] .guide-card{padding:11px 13px 10px}
#merchantDetails[data-guide=true] .guide-demo{height:96px;margin-top:6px}
#merchantDetails[data-guide=true] .merchant-actions{margin-top:12px}
#merchantDetails.merchant-book[data-guide=true] .merchant-actions button{min-height:44px;padding:8px 18px}
@media(max-height:700px) and (min-width:701px){
  #merchantDetails.merchant-book[data-guide=true]{padding-bottom:18px}
  #merchantDetails.merchant-book[data-guide=true] .merchant-book-sheet{max-height:calc(100svh - 72px);padding:8px 24px}
  #merchantDetails.merchant-book[data-guide=true] .merchant-book-heading{margin-bottom:8px}
  #merchantDetails[data-guide=true] .merchant-book-seal{width:36px;height:40px}
  #merchantDetails.merchant-book[data-guide=true] h2{font-size:28px}
  #merchantDetails[data-guide=true] .banquet-guide{gap:10px}
  #merchantDetails[data-guide=true] .guide-card{padding:8px 11px}
  #merchantDetails[data-guide=true] .guide-card p{font-size:12px!important;line-height:1.65!important}
  #merchantDetails[data-guide=true] .guide-demo{height:87px;margin-top:3px}
  #merchantDetails[data-guide=true] .merchant-actions{margin-top:10px}
}
