/* RD-07 inner layouts. Shared game/MMO chrome remains owned by the foundation. */
body:not([data-mobile="true"]) #center:has(.tabpane:not(.hidden) > .rd07-page),
body[data-mobile="true"][data-mp="game"] #center:has(.tabpane:not(.hidden) > .rd07-page) {
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}
#center > .tabpane:not(.hidden):has(> .rd07-page) { flex: 1 1 auto; min-height: 0; min-width: 0; overflow: hidden; container-type: size; }
.rd07-page { display: flex; flex-direction: column; height: 100%; min-height: 0; min-width: 0; gap: 10px; padding: 12px; overflow: hidden; color: #f7e5c2; font: 18px/1.35 Georgia, serif; background: linear-gradient(#06141ad9,#09151be8),url('../assets/ui/foundation-stone.png') center/cover; }
.rd07-page *, .guide * { box-sizing: border-box; }
.rd07-page [hidden] { display: none !important; }
.rd07-page h2, .rd07-page h3, .rd07-page p { margin: 0; border: 0; }
.rd07-page h2 { color: #ffe3a1; font-size: clamp(23px,2.2vw,34px); line-height: 1.15; }
.rd07-page h3 { color: #f5d69b; font-size: 21px; }
.rd07-page small, .rd07-note { font-size: 15px; line-height: 1.3; }
.rd07-note { color: #d8ceb9; flex: 0 0 auto; }
.rd07-icon { width: 24px; height: 24px; flex: 0 0 auto; filter: invert(90%) sepia(47%) saturate(400%); }
.rd07-page .btn, .guide .btn { min-height: 44px; padding: 8px 13px; color: #f6e5c9; font: inherit; line-height: 1.15; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: normal; overflow-wrap: anywhere; border: 1px solid #ae8950; background: linear-gradient(#263138,#101b23); clip-path: polygon(9px 0,calc(100% - 9px) 0,100% 9px,100% calc(100% - 9px),calc(100% - 9px) 100%,9px 100%,0 calc(100% - 9px),0 9px); position: relative; }
.rd07-page .btn::after, .guide .btn::after { content: ''; pointer-events: none; position: absolute; inset: 0; background: linear-gradient(135deg,transparent 5px,#ae8950 5px,#ae8950 6px,transparent 6px) top left/10px 10px no-repeat,linear-gradient(225deg,transparent 5px,#ae8950 5px,#ae8950 6px,transparent 6px) top right/10px 10px no-repeat,linear-gradient(45deg,transparent 5px,#ae8950 5px,#ae8950 6px,transparent 6px) bottom left/10px 10px no-repeat,linear-gradient(315deg,transparent 5px,#ae8950 5px,#ae8950 6px,transparent 6px) bottom right/10px 10px no-repeat; }
.rd07-page .btn.primary, .guide .btn.primary { color: #fff0cb; border-color: #f4c65e; background: linear-gradient(#9f712b,#483313 65%,#77531e); box-shadow: inset 0 0 8px #e8b45088; }
.rd07-page .btn:focus-visible, .guide .btn:focus-visible { outline: 3px solid #52e7fa; outline-offset: -4px; }
.rd07-page .btn:disabled, .guide .btn:disabled { opacity: .58; }
.rd07-page .btn small { display: block; }
.rd07-tabs { display: flex; gap: 5px; flex: 0 0 auto; border-bottom: 1px solid #a1824d; padding-bottom: 3px; }
.rd07-tabs .btn { flex: 1 1 0; min-width: 0; }
.rd07-tabs .btn.primary { color: #b6fbff; background: linear-gradient(#173e49,#0c252f); border-color: #5cd7de; box-shadow: inset 0 0 7px #3cd5e466; }
.rd07-pager { display: flex; justify-content: center; align-items: center; gap: 14px; flex: 0 0 auto; min-height: 44px; }
.rd07-pager .btn { min-width: 64px; }
.rd07-pager output { flex: 0 0 auto; min-width: 44px; text-align: center; font: 16px/1.2 Arial,sans-serif; }
.rd07-text-pager .btn { padding: 5px 10px; font-size: 15px; }
.rd07-reader-frame { flex: 1 1 auto; min-height: 48px; min-width: 0; overflow: hidden; }
.rd07-reader { height: 100%; min-height: 0; overflow: hidden; columns: 1; column-fill: auto; column-gap: 24px; overflow-wrap: anywhere; font-size: inherit; }
.rd07-reader p { margin: 0 0 .65em; }
.rd07-card { min-height: 0; min-width: 0; display: flex; flex-direction: column; gap: 10px; padding: 16px; border: 1px solid #be9651; box-shadow: inset 0 0 0 3px #0b1319,inset 0 0 0 4px #59492f; background: linear-gradient(#071821bd,#09151cd9),url('../assets/ui/foundation-stone.png') center/cover; }
.rd07-scene { display: block; width: 100%; min-height: 0; height: clamp(90px,22cqh,200px); object-fit: cover; border: 1px solid #9b7845; flex: 0 1 auto; }
.rd07-badge { color: #e7c47b; border: 1px solid #987741; padding: 4px 8px; font-size: 16px; white-space: nowrap; }
.exploration-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex: 0 0 auto; }
.exploration-hero { display: flex; align-items: stretch; gap: 14px; flex: 0 1 auto; min-height: 0; }
.exploration-hero > .rd07-scene { flex: 1 1 auto; min-width: 0; height: clamp(80px,28cqh,230px); }
.exploration-hero > .btn { flex: 0 0 28%; align-self: center; min-height: 62px; font-size: 24px; }
.exploration-content { display: flex; flex-direction: column; gap: 9px; flex: 1 1 auto; min-height: 0; min-width: 0; }
.exploration-card-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(160px,1fr)); min-height: 0; flex: 1 1 auto; gap: 10px; }
.exploration-card-grid article { display: flex; flex-direction: column; gap: 8px; padding: 10px; background: #0d2029; border: 1px solid #876d42; min-height: 0; min-width: 0; }
.exploration-card-grid article p { flex: 1; min-height: 0; overflow: auto; font-size: 16px; }
.exploration-menu { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; min-height: 0; flex: 1; }
.exploration-menu > .btn { min-height: 44px; }
.exploration-log.log { flex: 1 1 auto; max-height: none; min-height: 0; overflow: auto; font-size: 16px; }
.exploration-result { flex: 1 1 auto; }
.exploration-result > .btn { align-self: center; min-width: 220px; }
.exploration-content > .story-hint { margin: 0; flex: 0 0 auto; font-size: 16px; }
.exploration-adventure { flex: 1; min-height: 0; overflow: auto; } /* Existing RD08/09 entry panels, not the whole location. */
body[data-mobile="true"] .rd07-page { padding: 7px; gap: 7px; font-size: 17px; }
body[data-mobile="true"] .rd07-page h2 { font-size: 26px; }
body[data-mobile="true"] .rd07-page h3 { font-size: 19px; }
body[data-mobile="true"] .rd07-card { padding: 10px; gap: 7px; }
body[data-mobile="true"] .rd07-tabs .btn { padding: 6px 3px; font-size: 14px; gap: 3px; }
body[data-mobile="true"] .rd07-tabs .rd07-icon { width: 18px; height: 18px; }
body[data-mobile="true"] .rd07-note, body[data-mobile="true"] .rd07-page small { font-size: 14px; }
body[data-mobile="true"] .rd07-badge { font-size: 13px; padding: 3px 5px; }
body[data-mobile="true"] .exploration-heading { align-items: flex-start; }
body[data-mobile="true"] .exploration-heading h2 { font-size: 23px; }
body[data-mobile="true"] .exploration-hero { flex-direction: column; gap: 6px; }
body[data-mobile="true"] .exploration-hero > .rd07-scene { width: 100%; height: clamp(65px,22cqh,145px); flex: 0 1 auto; }
body[data-mobile="true"] .exploration-hero > .btn { flex: 0 0 auto; min-height: 44px; font-size: 20px; align-self: stretch; }
body[data-mobile="true"] .exploration-card-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; }
body[data-mobile="true"] .exploration-card-grid > :only-child { grid-column: 1 / -1; }
body[data-mobile="true"] .exploration-card-grid article { padding: 7px; gap: 5px; }
@container (max-height: 470px) {
  .rd07-page { padding: 6px; gap: 5px; font-size: 16px; }
  .rd07-page .rd07-scene { height: 65px; }
  .rd07-page.decision .rd07-scene, .rd07-page.dialogue .rd07-scene, .rd07-page.outcome .rd07-scene { display: none; }
  .exploration-hero > .rd07-scene { height: 50px !important; }
  .rd07-card { padding: 8px; gap: 5px; }
  .rd07-page .rd07-reader-frame { min-height: 38px; }
  .rd07-page h2 { font-size: 23px; }
  .rd07-page .btn { padding: 5px 7px; }
  .exploration-content > .story-hint { font-size: 14px; }
}
@container (max-height: 310px) and (min-width: 471px) {
  .exploration-page.idle { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.3fr); grid-template-rows: auto 44px minmax(0,1fr); gap: 5px 8px; }
  .exploration-heading { grid-column: 1; grid-row: 1; }
  .exploration-heading h2 { font-size: 21px; }
  .exploration-hero { grid-column: 1; grid-row: 2 / -1; flex-direction: column; }
  .exploration-hero > .rd07-scene { flex: 1; height: 0 !important; min-height: 0; }
  .exploration-hero > .btn { min-height: 44px; align-self: stretch; font-size: 18px; flex: 0 0 auto; }
  .exploration-page.idle > .rd07-tabs { grid-column: 2; grid-row: 1 / 3; }
  .exploration-page.idle > .exploration-content { grid-column: 2; grid-row: 3; }
  .exploration-page.idle > .rd07-tabs .btn { font-size: 13px; padding: 3px; }
  .exploration-page.idle > .rd07-tabs .rd07-icon { display: none; }
  .exploration-page.idle > .rd07-tabs { align-self: start; }
  .exploration-content > .story-hint { display: none; } /* same quest link remains under More and global tabs */
}
@media (prefers-reduced-motion: reduce) { .rd07-page *, .guide * { animation: none !important; transition: none !important; } }
