/* 近侍 shares the 风波与线索 palette, opening background and character
   dossier ornaments. One parchment holds reports left and errands right. */
body[data-game='palace'].game-shell #game[data-page='attendant'] {
 display:block;position:relative;box-sizing:border-box;
 padding:clamp(10px,2cqh,24px) clamp(12px,2cqw,34px);
 color:#574535;
 background:linear-gradient(rgba(250,240,221,.1),rgba(250,240,221,.16)),
  var(--palace-quiet-folio-image) center / cover;
}
body[data-game='palace'] #game[data-page='attendant'] > :is(.game-hud,.game-background,[data-return-home]) {
 display:none;
}
body[data-game='palace'].game-shell #game[data-page='attendant'] > #tab-content.game-content.attendant-page {
 position:relative;inset:auto;display:flex;flex-direction:column;
 gap:clamp(8px,1.5cqh,18px);width:100%;height:100%;min-width:0;min-height:0;
 box-sizing:border-box;grid-column:auto;grid-row:auto;
 margin:0;padding:0;overflow:hidden;background:none;border:0;box-shadow:none;backdrop-filter:none;
 color:#574535;
}
#game[data-page='attendant'] .attendant-heading {
 display:flex;align-items:center;justify-content:flex-start;
 flex:none;min-width:0;gap:clamp(12px,2cqw,34px);padding-right:48px;
}
#game[data-page='attendant'] .attendant-heading > h2 {
 margin:0;font-size:calc((clamp(19px,2cqw,30px)) * var(--text-scale));font-weight:600;line-height:1.4;color:#60472f;
}
#game[data-page='attendant'] .attendant-heading > button {
 flex:none;margin:0;min-height:32px;font-size:var(--font-body);
}
/* Clue-paper is deliberately reused: its gold corner art and warm translucent
   fill already match the investigation page, without duplicating assets. */
#game[data-page='attendant'] .attendant-layout.clue-paper {
 display:grid;grid-template-columns:minmax(0,1.8fr) 1px minmax(0,1fr);
 flex:1;min-width:0;min-height:0;align-items:stretch;
 gap:clamp(9px,1.5cqw,22px);
 margin:0;padding:clamp(11px,1.6cqw,24px);
 background:rgba(255,248,233,.76);border:1px solid #b394616f;
 border-radius:12px;box-shadow:0 4px 18px #4f391d17,inset 0 0 12px #ffffff47;
 overflow:hidden;isolation:isolate;
}
#game[data-page='attendant'] .attendant-layout > .dossier-corner-top {
 position:absolute;top:0;right:0;width:clamp(54px,9cqw,120px);
}
#game[data-page='attendant'] .attendant-layout > .dossier-corner-bottom {
 position:absolute;bottom:0;left:0;width:clamp(54px,9cqw,120px);
}
#game[data-page='attendant'] .attendant-layout > .dossier-column-divider {
 position:relative;inset:auto;left:auto;top:auto;bottom:auto;
 display:block;align-self:stretch;width:1px;height:auto;min-height:32px;
 background:linear-gradient(180deg,transparent,#b79c6755 20%,#b79c6755 80%,transparent);
 pointer-events:none;
}
#game[data-page='attendant'] .attendant-layout > .dossier-column-divider .dossier-column-jewel {
 position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);opacity:.42;
}
/* One scroller owns the paper. Independent GPU scroll layers in both columns
   could repaint the single vault card in several places on mobile. */
html body[data-game='palace'] #game[data-page='attendant'] > #tab-content.game-content .attendant-layout.clue-paper.palace-ledger-folio {
 overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;
 scrollbar-width:thin;scrollbar-color:#aa8a5955 transparent;
}
#game[data-page='attendant'] .attendant-reading,
#game[data-page='attendant'] .attendant-controls {
 position:relative;z-index:1;display:flex;flex-direction:column;
 min-width:0;min-height:0;gap:clamp(7px,1.2cqh,13px);
 padding:1px 4px 8px 0;
 overflow:visible;
}
#game[data-page='attendant'] :is(.attendant-reading,.attendant-controls) > h3.dossier-section-heading {
 flex:none;display:flex;align-items:center;gap:clamp(5px,.65cqw,12px);
 margin:0 0 clamp(4px,.8cqh,9px);
 font-size:var(--font-section);font-weight:600;line-height:1.3;
 color:#694b2e;letter-spacing:.04em;
}
/* Separate the three reading sections without assigning fixed heights.
   Only headings after a content block get one extra line of breathing room. */
#game[data-page='attendant'] .attendant-reading > .attendant-info-section + h3.dossier-section-heading {
 margin-top:clamp(18px,2.6cqh,26px);
}
#game[data-page='attendant'] .attendant-layout .dossier-heading-flower {
 width:clamp(18px,2.5cqw,37px);height:clamp(18px,3.5cqh,34px);
}
#game[data-page='attendant'] .attendant-layout .dossier-heading-end {
 width:clamp(16px,2.6cqw,40px);height:clamp(9px,2cqh,18px);
}
/* Reading blocks have no nested card tint; the underlying ornamental paper
   is continuous, exactly as requested in the earlier attendant layout pass. */
html body.game-shell #game[data-page='attendant'] .attendant-reading > .attendant-info-section {
 flex:none;min-width:0;box-sizing:border-box;margin:0;
 padding:clamp(3px,.6cqh,8px) clamp(3px,.5cqw,8px);
 background:none;border:0;border-radius:0;box-shadow:none;
}
#game[data-page='attendant'] .attendant-reading p {
 white-space:pre-line;overflow-wrap:anywhere;line-height:1.65;
 font-size:var(--font-body);color:#574535;margin:5px 0;
}
#game[data-page='attendant'] .attendant-info-section > p {margin:3px 0 0;}
/* The task names sit close to their floral heading; other section gaps stay unchanged. */
html body.game-shell #game[data-page='attendant'] .attendant-reading > .attendant-info-section.attendant-in-progress {
 margin-top:calc(-1 * clamp(6px,1cqh,11px));padding-top:0;
}

#game[data-page='attendant'] :is(.attendant-reading,.attendant-controls) > .v3-card {
 min-width:0;margin:0;box-sizing:border-box;
 padding:clamp(10px,1.3cqw,19px);
 border:1px solid #b394613d;border-radius:9px;
 background:rgba(255,251,242,.35);box-shadow:none;
}
#game[data-page='attendant'] .v3-card > h2 {
 font-size:var(--font-heading);font-weight:600;
 color:#694b2e;margin:0 0 7px;
}
#game[data-page='attendant'] .attendant-reading > .attendant-history {
 flex:none;min-width:0;
 padding:0 clamp(3px,.5cqw,8px);
 background:none;border:0;box-shadow:none;
}
#game[data-page='attendant'] :is(.attendant-done-task,.attendant-courier-record) {
 min-width:0;padding:7px 0;margin:0;border-bottom:1px solid #b3946140;
}
#game[data-page='attendant'] .attendant-history > .attendant-done-task:last-child {
 border-bottom:0;
}
#game[data-page='attendant'] :is(.attendant-done-task,.attendant-courier-record) > summary {
 cursor:pointer;font-size:var(--font-body);line-height:1.6;
 color:#654f39;overflow-wrap:anywhere;
}
@media (orientation:landscape) and (max-height:440px) {
 body[data-game='palace'].game-shell #game[data-page='attendant'] {
  padding:7px 10px;
 }
 body[data-game='palace'] #game[data-page='attendant'] > #tab-content.attendant-page {
  gap:5px;
 }
 #game[data-page='attendant'] .attendant-layout.clue-paper {
  grid-template-columns:minmax(0,1.45fr) 1px minmax(0,1fr);
  gap:clamp(7px,1.05cqw,12px);padding:8px 11px;
 }
 #game[data-page='attendant'] :is(.attendant-reading,.attendant-controls) {
  gap:5px;padding-bottom:3px;
 }
 #game[data-page='attendant'] :is(.attendant-reading,.attendant-controls) > h3.dossier-section-heading {
  margin-bottom:2px;font-size:var(--font-section);
 }
 #game[data-page='attendant'] .attendant-reading p {font-size:var(--font-body);line-height:1.5;}
 #game[data-page='attendant'] .attendant-heading > h2 {font-size:var(--font-heading);}
}


/* A quiet treasury entry replaces the former one-item dispatch form. */
#game[data-page='attendant'] .attendant-vault-entry {
 display:flex;flex-direction:column;align-items:stretch;gap:clamp(9px,1.5cqh,17px);
 flex:none;min-width:0;padding:clamp(14px,1.75cqw,23px);
 border:1px solid #b3946159;border-radius:9px;
 background:rgba(255,251,242,.38);color:#594631;
}
#game[data-page='attendant'] .attendant-vault-entry > h2 {
 margin:0;font-size:var(--font-heading);
 font-weight:600;color:#694b2e;
}
#game[data-page='attendant'] .attendant-vault-entrances{
 display:grid;grid-template-columns:minmax(0,1fr);
 gap:clamp(7px,1.1cqh,12px);min-width:0;
}
#game[data-page='attendant'] .attendant-vault-entrances > button{
 display:flex;align-items:center;justify-content:center;min-width:0;
 min-height:clamp(37px,6cqh,52px);padding:5px 4px;margin:0;
 border:1px solid #ac8b5891;border-radius:7px;
 color:#684b2d;background:rgba(247,236,215,.73);
 font-size:var(--font-body);font-weight:600;cursor:pointer;
}
#game[data-page='attendant'] .attendant-vault-entrances > button:hover,
#game[data-page='attendant'] .attendant-vault-entrances > button:focus-visible{
 background:#f3e5cc;border-color:#a47d42;
}

/* The library is its own page, using the same parchment and ornamentation. */
body[data-game='palace'] #game[data-page='attendant'] > #tab-content.attendant-vault-page .attendant-vault-paper {
 position:relative;display:flex;flex-direction:column;align-items:stretch;
 flex:1 1 auto;box-sizing:border-box;min-width:0;min-height:0;
 width:min(100%,1020px);max-width:1020px;
 margin:0 auto;padding:clamp(17px,2.3cqw,33px);
 overflow:hidden;isolation:isolate;
 background:rgba(255,248,233,.81);border:1px solid #b394616f;
 border-radius:12px;box-shadow:0 4px 18px #4f391d17,inset 0 0 12px #ffffff47;
}
#game[data-page='attendant'] .attendant-vault-paper > .dossier-corner-top {
 position:absolute;top:0;right:0;width:clamp(54px,9cqw,120px);
}
#game[data-page='attendant'] .attendant-vault-paper > .dossier-corner-bottom {
 position:absolute;bottom:0;left:0;width:clamp(54px,9cqw,120px);
}
/* Dedicated treasury pages: a single scroll surface, no inner navigation. */
#game[data-page='attendant'] .attendant-vault-page .attendant-vault-content{
 position:relative;z-index:1;display:block;flex:1;
 min-width:0;min-height:0;padding:clamp(7px,1.2cqh,13px) clamp(2px,.7cqw,10px);
 overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;
}
#game[data-page='attendant'] .attendant-vault-content .economy-row{
 display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;
 gap:clamp(6px,1.2cqw,16px);margin:0 0 clamp(9px,1.4cqh,17px);padding:0 0 clamp(7px,1.1cqh,11px);
 border-bottom:1px solid rgba(163,132,82,.24);
}
#game[data-page='attendant'] .attendant-vault-content .economy-row p{
 margin:0;color:#6e5438;font-size:var(--font-body);white-space:nowrap;
}
#game[data-page='attendant'] .attendant-vault-content .economy-row button{
 min-height:clamp(32px,5.5cqh,43px);padding:4px clamp(8px,1cqw,15px);
 margin:0;border:1px solid #ad9267;border-radius:7px;
 background:rgba(244,231,205,.78);color:#65472c;font-size:var(--font-note);
}
#game[data-page='attendant'] .attendant-vault-content .economy-row button:disabled{
 opacity:.54;cursor:not-allowed;
}
#game[data-page='attendant'] .attendant-vault-content .economy-stock-grid{
 display:grid;grid-template-columns:repeat(4,minmax(0,1fr));
 gap:clamp(6px,.75cqw,12px);min-width:0;
}
#game[data-page='attendant'] .attendant-vault-content .economy-stock-tile{
 box-sizing:border-box;min-width:0;min-height:clamp(70px,12cqh,108px);
 padding:clamp(7px,.9cqh,11px) clamp(8px,1cqw,13px);
 border:1px solid rgba(153,121,73,.72);border-radius:9px;
 background:rgba(255,251,242,.38);color:#654f36;overflow-wrap:anywhere;
}
#game[data-page='attendant'] .attendant-vault-content .economy-stock-tile summary{
 min-height:0;cursor:pointer;font-size:var(--font-body);line-height:1.4;
}
#game[data-page='attendant'] .attendant-vault-content .economy-stock-tile[data-overflow='true']{
 border-style:dashed;background:rgba(235,222,201,.5);
}
#game[data-page='attendant'] .attendant-vault-content .economy-empty{
 display:flex;align-items:center;color:#a3937d;font-size:var(--font-note);
}
#game[data-page='attendant'] .attendant-vault-content .economy-stock-detail{
 border-top:1px solid #ad936c55;margin-top:6px;padding-top:6px;font-size:var(--font-note);
}
#game[data-page='attendant'] .attendant-vault-content .economy-stock-detail p{
 margin:3px 0;font-size:var(--font-note);
}
#game[data-page='attendant'] .attendant-vault-wardrobe-empty{
 display:flex;align-items:center;justify-content:center;min-height:55%;
}
#game[data-page='attendant'] .attendant-vault-empty{
 margin:0;color:#8a7359;font-size:var(--font-body);line-height:1.6;
}
#game[data-page='attendant'] .attendant-vault-ledger{
 display:flex;flex-direction:column;max-width:100%;min-width:0;
}
#game[data-page='attendant'] .attendant-vault-ledger .player-treasury-ledger-row{
 display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;
 gap:clamp(10px,1.3cqw,22px);padding:clamp(8px,1.2cqh,13px) 2px;
 border-bottom:1px solid rgba(163,132,82,.23);
}
#game[data-page='attendant'] .attendant-vault-ledger .player-treasury-ledger-detail{
 display:flex;flex-direction:column;gap:3px;min-width:0;overflow-wrap:anywhere;
 color:#614f3a;font-size:var(--font-body);
}
#game[data-page='attendant'] .attendant-vault-ledger .player-treasury-ledger-detail small{
 color:#907c65;font-size:var(--font-note);
}
#game[data-page='attendant'] .attendant-vault-ledger .player-treasury-ledger-amount{
 font-size:var(--font-body);color:#775a41;
 white-space:nowrap;font-variant-numeric:tabular-nums;
}
#game[data-page='attendant'] .attendant-vault-ledger .player-treasury-ledger-row[data-direction='income'] .player-treasury-ledger-amount{color:#58755b;}
@media (orientation:landscape) and (max-height:440px){
 #game[data-page='attendant'] .attendant-vault-entry{padding:10px;}
 body[data-game='palace'] #game[data-page='attendant'] > #tab-content.attendant-vault-page .attendant-vault-paper{
  padding:clamp(9px,1.2cqw,15px);
 }
 #game[data-page='attendant'] .attendant-vault-content .economy-stock-tile{
  min-height:clamp(62px,11cqh,83px);padding:5px 8px;
 }
 #game[data-page='attendant'] .attendant-vault-content .economy-stock-grid{gap:6px;}
 #game[data-page='attendant'] .attendant-vault-entrances > button{min-height:33px;}
}
@media (max-width:660px){
 #game[data-page='attendant'] .attendant-vault-content .economy-stock-grid{
  grid-template-columns:repeat(3,minmax(0,1fr));
 }
}
