/* Common browsing frame; specialized dossiers, map and investigations own theirs. */
html body.game-shell #game[data-browse='true'] > .game-hud {display:none;}
html body.game-shell #game[data-browse='true']:is([data-page='settings'],[data-page='saves'],[data-page='debug'],[data-page='context'],[data-page='attendant'],[data-page='characters']) {display:block;padding:0;}
html body.game-shell #game[data-browse='true']:is([data-page='settings'],[data-page='saves'],[data-page='debug']) #tab-content.game-content {
 position:absolute;inset:8cqh 3cqw 3cqh;width:auto;height:auto;max-height:none;margin:0;padding:clamp(10px,1.8cqw,24px);overflow:auto;grid-column:auto;grid-row:auto;
}
html body.game-shell #game[data-browse='true'] > [data-browse-back] {position:absolute;top:1.5cqh;left:3cqw;margin:0;min-height:32px;}
html body.game-shell #game[data-page='context'] #tab-content.game-content {
 position:absolute;inset:2cqh 2.5cqw;box-sizing:border-box;overflow:auto;backdrop-filter:none;
 padding:clamp(10px,1.5cqw,20px);background:rgba(255,247,230,.94);color:var(--palace-ink,#513724);border:1px solid #b39461;border-radius:12px;
}
html body.game-shell #game[data-page='context'] .v3-card {padding:10px 14px;margin:8px 0;background:rgba(255,250,240,.75);border:1px solid #b394615c;border-radius:9px;}
html body.game-shell #game[data-page='context'] h2 {font-size:var(--font-heading);margin:0 0 6px;}
html body.game-shell #game[data-page='context'] p {white-space:pre-line;line-height:1.5;}

/* A single formal-activity folio, styled alongside the character,
   attendant and investigation ledgers. The notification inbox below keeps
   its existing compact notice layout. */
html body[data-game='palace'].game-shell #game[data-browse='true'][data-page='context'] > #tab-content.game-content.context-detail-page {
 position:absolute;inset:0;box-sizing:border-box;
 display:flex;flex-direction:column;gap:clamp(7px,1.4cqh,16px);
 width:100%;height:100%;max-height:none;min-width:0;min-height:0;
 margin:0;padding:clamp(10px,2cqh,23px) clamp(12px,2cqw,34px);
 overflow:hidden;backdrop-filter:none;
 background:linear-gradient(rgba(250,240,221,.1),rgba(250,240,221,.16)),
  var(--palace-quiet-folio-image) center / cover;
 color:#574535;border:0;border-radius:0;box-shadow:none;
}
#game[data-page='context'] .context-detail-topbar {
 display:flex;align-items:center;flex:none;min-width:0;
 gap:clamp(9px,1.8cqw,25px);padding:0 clamp(3px,.8cqw,11px);
}
#game[data-page='context'] .context-detail-topbar > button {
 flex:none;min-height:32px;margin:0;padding:3px 9px;
 font-size:var(--font-body);
}
#game[data-page='context'] .context-detail-topbar > h2 {
 margin:0;color:#60472f;font-size:var(--font-heading);
 line-height:1.4;font-weight:600;
}
html body[data-game='palace'] #game[data-page='context'] .context-detail-folio {
 box-sizing:border-box;position:relative;isolation:isolate;
 display:flex;flex-direction:column;flex:1 1 auto;
 width:calc(100% - clamp(42px,7cqw,128px));max-width:1200px;
 min-height:0;min-width:0;margin:0 auto clamp(8px,2.4cqh,23px);
 padding:clamp(12px,1.75cqw,24px);
 overflow:hidden;background:rgba(255,248,233,.83);
 border:1px solid rgba(179,148,97,.55);border-radius:12px;
 box-shadow:0 4px 18px rgba(79,57,29,.10),inset 0 0 13px rgba(255,255,255,.3);
}
#game[data-page='context'] .context-detail-folio > .dossier-ornament {
 position:absolute;z-index:0;opacity:.22;pointer-events:none;
}
#game[data-page='context'] .context-detail-folio > .dossier-corner-top {
 top:0;right:0;width:clamp(54px,9cqw,120px);
}
#game[data-page='context'] .context-detail-folio > .dossier-corner-bottom {
 bottom:0;left:0;width:clamp(54px,9cqw,120px);
}
#game[data-page='context'] .context-detail-scroll {
 position:relative;z-index:1;flex:1 1 auto;min-height:0;min-width:0;
 overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;
 scrollbar-width:thin;scrollbar-color:rgba(167,132,78,.35) transparent;
 padding:0 clamp(3px,.7cqw,10px) clamp(8px,1.5cqh,16px);
}
#game[data-page='context'] .context-detail-identity {
 margin:0 0 clamp(10px,2.1cqh,23px);
 padding:clamp(2px,.5cqh,6px) clamp(2px,.5cqw,8px) clamp(11px,2cqh,22px);
 border-bottom:1px solid rgba(164,132,83,.34);
 text-align:left;
}
#game[data-page='context'] .context-detail-identity > h2 {
 margin:0;color:#5d4129;font-size:var(--font-body);
 line-height:1.45;font-weight:600;letter-spacing:.06em;
}
#game[data-page='context'] .context-detail-meta,
#game[data-page='context'] .context-detail-subtitle {
 margin:clamp(4px,.8cqh,8px) 0 0;
 color:#856b4d;font-size:var(--font-body);
 line-height:1.5;text-align:left;
}
#game[data-page='context'] .context-detail-subtitle {
 margin:0 0 clamp(10px,1.3cqh,15px);
 color:#725b41;
}
#game[data-page='context'] .context-detail-section {
 margin:0;padding:0 0 clamp(12px,2.1cqh,22px);
}
#game[data-page='context'] .context-detail-section + .context-detail-section {
 padding-top:clamp(6px,1cqh,11px);
 border-top:1px solid rgba(164,132,83,.2);
}
#game[data-page='context'] .context-detail-section > .dossier-section-heading,
#game[data-page='context'] .context-other-title {
 display:flex;align-items:center;gap:clamp(5px,.9cqw,12px);
 margin:0 0 clamp(5px,.9cqh,10px);
 color:#694b2f;font-size:var(--font-section);
 line-height:1.4;font-weight:600;letter-spacing:.04em;
}
#game[data-page='context'] .context-detail-section .dossier-heading-flower {
 flex:none;width:clamp(19px,2.5cqw,32px);height:clamp(19px,2.6cqh,30px);
 object-fit:contain;
}
#game[data-page='context'] .context-detail-section .dossier-heading-line {
 flex:1;min-width:8px;height:1px;background:rgba(164,132,83,.3);
}
#game[data-page='context'] .context-detail-section .dossier-heading-end {
 flex:none;width:clamp(20px,2.9cqw,38px);height:clamp(9px,1.6cqh,15px);
 object-fit:contain;
}
#game[data-page='context'] .context-detail-paragraph {
 margin:5px 0 0;padding:0 clamp(2px,.5cqw,8px);
 color:#594636;font-size:var(--font-body);
 line-height:1.75;white-space:pre-line;overflow-wrap:anywhere;
}
#game[data-page='context'] .context-detail-actions {
 display:flex;gap:10px;justify-content:flex-start;flex-wrap:wrap;
 padding:clamp(3px,.6cqh,7px) 0 clamp(13px,2.2cqh,22px);
}
#game[data-page='context'] .context-detail-actions > button {
 min-height:clamp(34px,4.7cqh,44px);margin:0;
 padding:6px clamp(14px,2.1cqw,24px);
 font:inherit;font-size:var(--font-body);
 color:#634527;background:linear-gradient(180deg,rgba(255,250,233,.95),rgba(232,209,171,.9));
 border:1px solid rgba(156,114,62,.53);border-radius:7px;
 box-shadow:0 2px 7px rgba(85,57,28,.12);cursor:pointer;
}
#game[data-page='context'] .context-detail-actions > button:hover {
 border-color:#a27b4c;background:#fff5df;
}
/* Completion information stays visible on touch screens, which have no hover
   tooltip. The existing button label and position are unchanged. */
#game[data-page='context'] .context-detail-actions > button.pregnancy-care-unavailable {
 display:inline-flex;align-items:center;gap:7px;
 opacity:.48;cursor:not-allowed;
}
#game[data-page='context'] .context-detail-actions > button.pregnancy-care-unavailable:hover {
 background-color:var(--palace-paper);border-color:var(--palace-gold);
}
#game[data-page='context'] .pregnancy-care-status {
 font-size:var(--font-note);font-weight:400;color:inherit;
 white-space:nowrap;
}
#game[data-page='context'] .context-more {
 border-bottom:0;
}
#game[data-page='context'] .context-more > summary {
 display:flex;align-items:center;gap:8px;cursor:pointer;list-style:none;
 color:#674b30;padding:6px 3px;
 font-size:var(--font-body);font-weight:600;
}
#game[data-page='context'] .context-more > summary::-webkit-details-marker {display:none;}
#game[data-page='context'] .context-more > summary::before {
 content:'›';display:inline-block;color:#967248;font-size:20px;
 transition:transform .15s ease;
}
#game[data-page='context'] .context-more[open] > summary::before {transform:rotate(90deg);}
#game[data-page='context'] .context-more-body {
 padding:3px clamp(5px,1cqw,15px) 10px;
}
#game[data-page='context'] .context-more-body > p {
 margin:7px 0;color:#614d39;font-size:var(--font-note);
 line-height:1.65;white-space:pre-line;overflow-wrap:anywhere;
}
#game[data-page='context'] .context-other-arrangements {
 margin:0;padding-top:clamp(7px,1.2cqh,14px);
}
#game[data-page='context'] .context-other-list {display:flex;flex-direction:column;}
#game[data-page='context'] .context-other-entry {
 display:flex;align-items:center;justify-content:space-between;
 gap:clamp(8px,1.4cqw,16px);width:100%;min-height:36px;
 margin:0;padding:8px 0;
 border:0;border-top:1px solid rgba(164,132,83,.2);border-radius:0;
 background:transparent;box-shadow:none;text-align:left;
 color:#5f4733;cursor:pointer;
}
#game[data-page='context'] .context-other-entry:hover,
#game[data-page='context'] .context-other-entry:focus-visible {
 background:rgba(181,146,97,.1);
}
#game[data-page='context'] .context-other-title {
 min-width:0;margin:0;overflow-wrap:anywhere;
}
#game[data-page='context'] .context-other-time {
 flex:none;color:#806b52;font-size:var(--font-note);white-space:nowrap;
}
#game[data-page='context'] .context-detail-page :is(button,summary):focus-visible {
 outline:2px solid #966d38;outline-offset:2px;
}
@media (orientation:landscape) and (max-height:450px) {
 html body[data-game='palace'].game-shell #game[data-page='context'] > #tab-content.context-detail-page {
  padding:7px 9px;gap:6px;
 }
 html body[data-game='palace'] #game[data-page='context'] .context-detail-folio {
  width:calc(100% - clamp(28px,5cqw,78px));
  margin-bottom:7px;padding:8px 12px;
 }
 #game[data-page='context'] .context-detail-identity {
  margin-bottom:7px;padding-bottom:8px;
 }
 #game[data-page='context'] .context-detail-section {
  padding-bottom:9px;
 }
 #game[data-page='context'] .context-detail-paragraph {line-height:1.6;}
 #game[data-page='context'] .context-other-entry {min-height:30px;padding:5px 0;}
}


/* Compact courier inbox, separate from the attendant work desk. */
#game[data-page='context'] .context-courier-page .context-detail-folio {
 max-width:980px;
}
#game[data-page='context'] .context-courier-inbox {
 display:flex;flex-direction:column;min-width:0;
}
#game[data-page='context'] .context-courier-count {
 margin:0;padding:3px 2px 10px;
 color:#856d51;font-size:var(--font-note);line-height:1.5;
}
#game[data-page='context'] .context-courier-message,
#game[data-page='context'] .context-courier-inbox > .imperial-night-message {
 display:flex;align-items:center;justify-content:space-between;
 flex-wrap:wrap;gap:8px clamp(12px,2cqw,25px);
 margin:0;padding:clamp(10px,1.7cqh,19px) 2px;
 border:0;border-top:1px solid rgba(164,132,83,.24);border-radius:0;
 background:none;box-shadow:none;
}
#game[data-page='context'] .context-courier-message > p,
#game[data-page='context'] .context-courier-inbox .imperial-night-message p {
 flex:1 1 20em;min-width:0;margin:0;
 color:#574535;font-size:var(--font-body);
 line-height:1.65;white-space:pre-line;overflow-wrap:anywhere;
}
#game[data-page='context'] .context-courier-message > button,
#game[data-page='context'] .context-courier-inbox .imperial-night-message button {
 flex:none;width:auto;min-width:clamp(54px,6cqw,85px);
 min-height:clamp(32px,4.8cqh,42px);margin:0;
 padding:5px clamp(9px,1.1cqw,15px);
 font-size:var(--font-body);text-align:center;white-space:nowrap;
}
#game[data-page='context'] .context-courier-inbox .imperial-night-message .attendant-notice-actions {
 display:flex;flex-wrap:wrap;align-items:center;gap:8px;
 margin:0 0 0 auto;
}
