/* Requested refinements only. Existing heading tracks and heights, membership
   text-box sizes and crafting-panel dimensions remain unchanged.
   Authorized changes: direct title size, navigation side, two crafting buttons. */
html[data-ui-theme="teal-cloud-a"] #game-root .sect-page .sect-membership-summary,
html[data-ui-theme="teal-cloud-a"] #game-root .sect-page :is(
  .sect-position-badge, .sect-contribution-badge
) {
  background: none !important;
  border-color: transparent !important;
  box-shadow: none !important;
  color: var(--tc-ink-strong, #203c36) !important;
}

html[data-ui-theme="teal-cloud-a"] #game-root .sect-page :is(
  .sect-membership-summary, .sect-position-badge, .sect-contribution-badge
)::before,
html[data-ui-theme="teal-cloud-a"] #game-root .sect-page :is(
  .sect-membership-summary, .sect-position-badge, .sect-contribution-badge
)::after {
  background: none !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

/* This is the actual three-column heading shared by ten page families.
   Sect building/task/shop subpages reuse the same direct-child heading. */
html[data-ui-theme="teal-cloud-a"] #game-root .page-panel > .feature-page-heading {
  background: none !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

html[data-ui-theme="teal-cloud-a"] #game-root .page-panel > .feature-page-heading::before,
html[data-ui-theme="teal-cloud-a"] #game-root .page-panel > .feature-page-heading::after {
  background: none !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

html[data-ui-theme="teal-cloud-a"] #game-root .page-panel > .feature-page-heading > h2 {
  position: relative;
  isolation: isolate;
  width: max-content;
  max-width: calc(100% - 24px);
  justify-self: center;
  grid-row: 1;
  font-size: 32px !important;
  font-weight: 800 !important;
  /* Original rendered title height is 27px; retain it as font size increases. */
  line-height: 27px !important;
  white-space: nowrap;
  background: none !important;
  border-color: transparent !important;
  box-shadow: none !important;
  color: var(--tc-ink-strong, #203c36) !important;
}

html[data-ui-theme="teal-cloud-a"] #game-root .page-panel > .feature-page-heading > h2::before {
  content: "" !important;
  position: absolute;
  inset: -4px -12px;
  width: auto;
  height: auto;
  transform: none;
  border: 1px solid var(--tc-bronze, #93805a);
  border-radius: 4px;
  background:
    var(--silk-corner-0) left 3px top 3px / 9px 9px no-repeat,
    var(--silk-corner-2) right 3px bottom 3px / 9px 9px no-repeat,
    linear-gradient(110deg, #d0dac1f2, #b7c9aff2) !important;
  box-shadow: inset 0 0 0 2px #ece4bb66, 0 1px 2px #39544929;
  opacity: 1;
  pointer-events: none;
  z-index: -1;
}

html[data-ui-theme="teal-cloud-a"] #game-root .page-panel > .feature-page-heading > h2::after {
  content: none !important;
}

/* Keep the existing three grid tracks: return left, contextual help right.
   Only named page-navigation controls move; dialog close buttons do not. */
html[data-ui-theme="teal-cloud-a"] #game-root .page-panel > .feature-page-heading > .page-back-button {
  grid-column: 1;
  grid-row: 1;
}

html[data-ui-theme="teal-cloud-a"] #game-root .page-panel > .feature-page-heading > :is(
  .feature-page-heading__leading, .companion-help-button, .sect-membership-summary
) {
  grid-column: 3;
  grid-row: 1;
}

/* Sect membership occupies the same right-side track now vacated by return.
   Preserve its original width, line breaks and left-aligned text. */
html[data-ui-theme="teal-cloud-a"] #game-root .sect-page > .feature-page-heading > .sect-membership-summary {
  justify-self: end;
}

/* Four Symbols uses flex headers rather than the standard page heading.
   Its three actual return actions move first without touching close controls. */
html[data-ui-theme="teal-cloud-a"] #game-root [data-four-symbols-host] :is(
  .four-header > [data-four-back],
  .four-leaderboard-header > [data-four-leaderboard-back],
  .four-leaderboard-header > [data-four-rewards-back]
) {
  order: -1;
}

/* Remove only the duplicate painted outer frame, retaining its border space,
   padding and quantity controls so the furnace/material layout does not move. */
html[data-ui-theme="teal-cloud-a"] #game-root .page-panel.cave-panel :is(.alchemy-panel, .forging-panel) > :is(
  .alchemy-control-panel, .forging-control-panel
) {
  background: none !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

html[data-ui-theme="teal-cloud-a"] #game-root .page-panel.cave-panel :is(.alchemy-panel, .forging-panel) > :is(
  .alchemy-control-panel, .forging-control-panel
)::before,
html[data-ui-theme="teal-cloud-a"] #game-root .page-panel.cave-panel :is(.alchemy-panel, .forging-panel) > :is(
  .alchemy-control-panel, .forging-control-panel
)::after {
  background: none !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

html[data-ui-theme="teal-cloud-a"] #game-root .cave-panel :is(
  .alchemy-primary-action, .forging-primary-action
) {
  width: max-content;
  min-width: 0;
  max-width: 100%;
  font-size: 20px !important;
  font-weight: 700;
  /* Existing 45px button height = 23px line + 20px padding + 2px border. */
  line-height: 23px;
  white-space: nowrap;
}
