/* C navigation: the website owns one clear bottom action row. The WeChat/browser
   system close area remains outside this row and is never represented by a
   lone icon inside the product UI. */
.site-action-bar {
  position: relative;
  z-index: 8;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  padding: 10px 16px max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(132, 101, 74, .16);
  background: rgba(255, 250, 246, .98);
  box-sizing: border-box;
}
.site-action-bar button {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border-radius: 14px;
  font: 650 14px/1.25 "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  letter-spacing: 0;
  cursor: pointer;
  touch-action: manipulation;
  white-space: normal;
  overflow-wrap: anywhere;
}
/* Navigation has one palette, including asynchronously loaded dialogs and dark
   previews. Only these two actions override local page/hover button themes. */
:root {
  --site-back-color: #a85f4d;
  --site-back-border: #c9826b;
  --site-back-background: #fffaf6;
  --site-home-color: #fff;
  --site-home-background: #b96755;
}
:is(.site-action-bar, .cc-site-actions, .account-site-actions, .pet-intro__actions) > button:not([data-site-home]):not([data-site-action="home"]) {
  color: var(--site-back-color) !important;
  border: 1px solid var(--site-back-border) !important;
  background: var(--site-back-background) !important;
}
:is(.site-action-bar, .cc-site-actions, .account-site-actions, .pet-intro__actions) > button:is([data-site-home], [data-site-action="home"]) {
  color: var(--site-home-color) !important;
  border: 1px solid var(--site-home-background) !important;
  background: var(--site-home-background) !important;
}
.site-action-bar button:active { transform: translateY(1px); }
.site-action-bar button:focus-visible { outline: 3px solid #7b9b73; outline-offset: 3px; }

/* Hide the legacy icon-only controls while leaving their event targets available
   to the action-bar bridge for a safe, bounded migration. */
#chatScreen > .chat-topbar > #backFromChat { visibility: visible !important; display: grid !important; pointer-events: auto; }
#appearanceScreen > .appearance-topbar .glass-button,
#sidePanel > .panel-header > .profile-back,
#sidePanel > .panel-header > #closePanelButton,
.bottom-sheet > .panel-header > button,
#mediaViewer > .viewer-toolbar > #closeViewerButton { display: none !important; }

#chatScreen .site-action-bar { flex: 0 0 auto; }

/* Selected B: one stable header/composer layout in every chat state. */
#chatScreen > .site-action-bar--screen {
  display:none!important;
}
.screen--appearance.is-active { display: flex; flex-direction: column; }
.screen--appearance.is-active .appearance-photo { flex: 0 0 auto; }
.screen--appearance.is-active .appearance-sheet,
.screen--appearance.is-active .generation-panel { flex: 0 1 auto; }
.screen--appearance.is-active .site-action-bar { position: relative; bottom: auto; margin-top: 12px; }
.screen--appearance .site-action-bar { z-index: 3; pointer-events: none; }
.screen--appearance .site-action-bar button { pointer-events: auto; }
#appearanceScreen.cc-b-screen .appearance-topbar { position: relative !important; inset: auto !important; top: auto !important; z-index: 1 !important; }
.side-panel { display: flex; flex-direction: column; }
.side-panel .panel-body { flex: 1 1 auto; }
.side-panel .site-action-bar { flex: 0 0 auto; width: 100%; margin: 0; }
.bottom-sheet { display: flex; flex-direction: column; }
.bottom-sheet > .site-action-bar { flex: 0 0 auto; margin-inline: -18px; width: calc(100% + 36px); }
#mediaViewer { display: flex; flex-direction: column; }
#mediaViewer .viewer-content { flex: 1 1 auto; min-height: 0; }
#mediaViewer .viewer-caption { flex: 0 0 auto; }
#mediaViewer .site-action-bar { flex: 0 0 auto; }

@media (min-width: 700px) {
  .site-action-bar { max-width: 520px; margin-inline: auto; border-radius: 16px 16px 0 0; }
  #chatScreen .site-action-bar,
  #appearanceScreen .site-action-bar { max-width: 480px; }
  .side-panel .site-action-bar { max-width: none; border-radius: 0; }
  #mediaViewer .site-action-bar { max-width: 520px; }
}
@media (max-width: 360px) {
  .site-action-bar { gap: 8px; padding-inline: 12px; }
  .site-action-bar button { min-height: 46px; padding-inline: 8px; font-size: 13px; }
}
