/* Shared page chrome, scoped to utility pages so combat and home keep their layout. */
.page-layout { --page-copy-size: .875rem; }
/* The app owns the outer gutter; page-specific panels only style their contents. */
#app > .page-layout {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px;
  width: 100%; max-width: none; min-width: 0; margin: 0; padding: 0;
  border: 0; border-radius: 0; background: transparent; box-shadow: none;
}
#app > .page-layout::before, #app > .page-layout::after { display: none; }
#app > .page-layout > :is(.page-heading,.panel,section,p) { margin-block: 0; }
.page-layout .page-back {
  position: static; display: flex; align-items: center; justify-content: flex-start;
  width: fit-content; max-width: 100%; min-height: 44px; margin: 0 0 8px;
  padding: 6px 0; border: 0; background: transparent; color: var(--muted);
  font-size: var(--page-copy-size); line-height: 1.5; text-align: left;
  text-decoration: none; align-self: start; justify-self: start;
}
.page-layout .page-back:hover { color: var(--text); }
.page-layout .page-back:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.page-layout > p, .page-layout :is(.settings-intro,.combat-role-intro,.help-intro-copy,.traversal-ranking-rule,.crystal-wallet-note,.formation-waiting-guide) { font-size: var(--page-copy-size); line-height: 1.7; }
.page-layout :is(.menu-card-copy > span,.setting-copy > span,.setting-copy > small,.setting-copy > p,.help-topic summary small,.adventurer-profile-field > small,.combat-role-tendency small,.combat-role-choice > span small,.items-category-panel > p,.inventory-item-copy > p,.inventory-item-copy > small) { font-size: .8125rem; line-height: 1.65; }
.page-layout :is(.menu-card-copy > strong,.menu-category h3,.settings-section-heading h3,.help-group-heading h2,.utility-section-heading h3,.items-category-heading strong) { font-size: 1rem; line-height: 1.5; }
.page-layout .menu-category-heading { min-height: 44px; }
.page-layout .help-group-heading > em { font-size: .8125rem; letter-spacing: normal; }
.page-layout .help-topic-content li { font-size: var(--page-copy-size); line-height: 1.8; }
.page-layout .formation-topline { justify-content: flex-end; margin: 0; }
.page-layout .formation-topline .page-back { margin-bottom: 0; }
.page-layout .formation-menu-back-bottom { margin-top: 8px; }
.page-layout :is(.equipment-board-heading strong,.equipment-accordion-heading strong) { font-size: 1rem; }
.page-layout .equipment-board-heading > em { font-size: .75rem; letter-spacing: normal; }
.explore-rest-screen.page-layout .expedition-board { gap: 12px; padding: 0; border: 0; background: transparent; box-shadow: none; overflow: visible; }
.explore-rest-screen.page-layout .expedition-board::before,
.explore-rest-screen.page-layout .expedition-board::after { display: none; }
.explore-rest-screen.page-layout .expedition-board > .page-heading { margin-bottom: 0; }
.page-layout :is(.expedition-mode-summary small,.expedition-zone-copy small,.expedition-zone-cost,.expedition-swipe-hint,.ex-destination-switch small) { font-size: .8125rem; line-height: 1.6; letter-spacing: normal; }
.page-layout .items-command-guide { font-size: .8125rem; }
.page-layout :is(.settings-menu-back,.help-menu-back,.items-menu-back,.traversal-menu-back) { margin-left: 0; }
.page-layout .help-intro { padding: 12px; }
.page-layout :is(.character-shop-header,.crystal-wallet-panel) { padding: 12px; }

/* All utility-page headings share the same structure, including narrow layouts. */
.page-layout .page-heading {
  --heading-crystal: 103 187 204; --heading-gold: 204 177 112;
  display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center;
  gap: 4px 12px; width: 100%; min-width: 0; min-height: 0;
  margin: 0 0 10px; padding: 6px 8px; position: relative; overflow: visible;
  border: 1px solid rgb(var(--heading-crystal) / 22%); border-radius: 9px;
  background: radial-gradient(ellipse at 0% 0%, rgb(var(--heading-crystal) / 11%), transparent 62%),
    linear-gradient(125deg, #12232c, #0b151d 72%);
  box-shadow: inset 0 1px rgb(230 244 244 / 4%), 0 5px 15px rgb(0 0 0 / 12%);
  text-align: left;
}
.page-layout .page-heading-main {
  display: grid; grid-template-columns: 32px minmax(0,1fr); align-items: start;
  gap: 8px; min-width: 0;
}
.page-layout .page-heading::before {
  display: block; content: ""; position: absolute; inset: auto; top: -1px; left: 14px; right: 14px;
  width: auto; border: 0; border-radius: 0; box-shadow: none; filter: none; transform: none;
  height: 1px; background: linear-gradient(90deg, transparent, rgb(var(--heading-gold) / 70%), rgb(var(--heading-crystal) / 52%), transparent);
  pointer-events: none;
}
.page-layout .page-heading::after {
  display: block; content: ""; position: absolute; inset: auto; top: 8px; right: 9px;
  width: 4px; height: 4px; border: 1px solid rgb(var(--heading-gold) / 48%);
  transform: rotate(45deg); background: transparent; box-shadow: none; pointer-events: none;
}
.page-layout .page-heading-icon {
  display: grid; place-items: center; width: 32px; height: 32px; min-width: 0;
  position: relative; isolation: isolate; margin-top: 2px;
}
.page-layout .page-heading-icon::before {
  content: ""; position: absolute; z-index: -1; inset: -3px;
  border: 1px solid rgb(var(--heading-gold) / 34%); border-radius: 50%;
  background: radial-gradient(circle, rgb(var(--heading-crystal) / 15%), rgb(0 0 0 / 12%) 74%);
  box-shadow: inset 0 0 0 3px rgb(6 15 21 / 40%); pointer-events: none;
}
.page-layout .page-heading-icon > *, .page-layout .page-heading-icon .abyss-mechanism-mark { margin: 0; width: 32px; height: 32px; max-width: 100%; }
.page-layout .page-heading-icon img { object-fit: contain; }
.page-layout .page-heading-copy { min-width: 0; }
.page-layout .page-heading .page-heading-copy h1 {
  margin: 0; color: #eee4cd; font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-weight: 600; font-size: 1.25rem; line-height: 1.2; letter-spacing: .045em;
  overflow-wrap: anywhere; white-space: normal; text-shadow: 0 1px 2px rgb(0 0 0 / 35%);
}
.page-layout .page-heading .page-heading-copy p {
  display: block; margin: 2px 0 0; color: #a4b7be; font-family: inherit;
  font-size: .875rem; font-weight: 400; line-height: 1.45; letter-spacing: normal;
  white-space: normal; overflow: visible; overflow-wrap: anywhere; text-overflow: clip;
}
.page-layout .page-heading-meta {
  display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center;
  gap: 4px 8px; min-width: 0; max-width: 100%; color: var(--muted);
  font-size: .75rem; line-height: 1.5; font-variant-numeric: tabular-nums;
  width: fit-content; padding: 1px 6px; border: 1px solid rgb(var(--heading-crystal) / 14%);
  border-radius: 5px; background: rgb(3 11 17 / 34%);
  box-shadow: inset 0 1px rgb(215 236 240 / 3%);
}
.page-layout .page-heading-meta > * {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px;
  position: static; inset: auto;
  min-width: 0; max-width: 100%; margin: 0; padding: 0; border: 0;
  background: transparent; text-align: right; white-space: normal;
}
.page-layout .page-heading-meta :is(small,em) { display: inline; font-size: .75rem; line-height: 1.5; letter-spacing: normal; }
.page-layout .page-heading-meta :is(strong,b) { font-size: .875rem; line-height: 1.4; letter-spacing: normal; }
.page-layout .page-heading-meta :is(button,a) { min-height: 44px; }
.page-layout .page-heading-meta .character-shop-wallet img { width: 20px; height: 20px; }
.page-layout .page-heading-meta .workshop-wallet > span { display: flex; align-items: baseline; gap: 6px; }
.page-layout .items-command-support { display: grid; gap: 10px; margin: 0 0 16px; }
.page-layout .expedition-loot-odds { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 8px 0 2px; color: #b8c4c4; font-size: .875rem; line-height: 1.6; }
.page-layout .expedition-loot-odds > span { white-space: nowrap; }
.page-layout .expedition-loot-odds strong { color: #e5cf92; font-variant-numeric: tabular-nums; }
.page-layout .expedition-loot-odds-note { margin: 0 0 8px; color: #a4b7be; font-size: .8125rem; line-height: 1.65; }
.page-layout .items-command-support .items-command-actions button { min-height: 44px; }
.page-layout .abyss-page-loading-console { min-height: 80px; padding: 12px 0; }
.page-layout .limited-abyss-loading-console { min-height: 0; padding: 0; text-align: left; }
@media (max-width: 600px) {
  .page-layout .page-heading { grid-template-columns: minmax(0,1fr); }
  .page-layout .page-heading .page-heading-meta { justify-content: flex-start; margin-left: 40px; }
  .page-layout .page-heading .page-heading-meta > * { width: auto; text-align: left; }
}
@media (max-width: 340px) {
  .page-layout .page-heading .page-heading-meta { margin-left: 0; }
}

/* Ranking refresh stays beside the title, including narrow utility layouts. */
.traversal-ranking-panel.page-layout > .traversal-command-header.page-heading {
  grid-template-columns: minmax(0,1fr) auto; column-gap: 8px;
}
.traversal-ranking-panel .traversal-command-header.page-heading .page-heading-meta {
  margin-left: 0; justify-self: end; justify-content: flex-end;
}
.traversal-ranking-panel .traversal-command-header.page-heading .traversal-refresh-button {
  align-items: center; justify-content: center; flex-wrap: nowrap; gap: 4px; min-width: 44px;
}
