/* PC polish overrides. Loaded last, scoped away from the home page. */
body.mobile-ui-enabled #homeConsolePane .pc-home-bazi-row {
  display: none !important;
}

@media (min-width: 900px) {
  body:not(.mobile-ui-enabled) #calSeg .mobile-home-cal-only,
  body:not(.mobile-ui-enabled) #calSeg button[data-cal="bazi"],
  body:not(.mobile-ui-enabled) #mobileCalendarSeg button[data-mobile-cal="bazi"] {
    display: none !important;
  }

  body:not(.mobile-ui-enabled) #birthPlaceSheet.birth-place-sheet .birth-wheel::before {
    content: none !important;
    display: none !important;
  }

  body:not(.mobile-ui-enabled) {
    --pc-polish-max: min(1180px, calc(100vw - 56px));
    --pc-polish-green: #4b6349;
    --pc-polish-green-deep: #354936;
    --pc-polish-green-soft: #6f8668;
    --pc-polish-gold: #c8a45d;
    --pc-polish-gold-light: #d6b76a;
    --pc-polish-bg: #f5f5f5;
    --pc-polish-card: #ffffff;
    --pc-polish-line: rgba(75, 99, 73, 0.16);
    --pc-polish-line-strong: rgba(75, 99, 73, 0.26);
    --pc-polish-text: #1d2a22;
    --pc-polish-muted: #617366;
  }

  body:not(.mobile-ui-enabled):not(.page-mode-home) {
    background: var(--pc-polish-bg) !important;
    color: var(--pc-polish-text);
  }

  body:not(.mobile-ui-enabled):not(.page-mode-home)::before {
    background:
      radial-gradient(900px 520px at 50% -180px, rgba(75, 99, 73, 0.16), transparent 70%),
      radial-gradient(680px 360px at 14% 18%, rgba(214, 183, 106, 0.12), transparent 64%),
      linear-gradient(180deg, #f8faf5 0%, #edf4ea 100%) !important;
    opacity: 1;
  }

  body:not(.mobile-ui-enabled):not(.page-mode-home)::after {
    background: radial-gradient(ellipse 120% 88% at 50% 44%, transparent 42%, rgba(75, 99, 73, 0.06) 100%) !important;
    opacity: 1;
  }

  body:not(.mobile-ui-enabled) #siteHeaderZone,
  body:not(.mobile-ui-enabled) .page-switch,
  body:not(.mobile-ui-enabled):not(.page-mode-home) .mingbook,
  body:not(.mobile-ui-enabled):not(.page-mode-home) .mobile-measure-pane,
  body:not(.mobile-ui-enabled):not(.page-mode-home) .mobile-single-reading-pane,
  body:not(.mobile-ui-enabled):not(.page-mode-home) .classics-pane,
  body:not(.mobile-ui-enabled):not(.page-mode-home) #pairPane,
  body:not(.mobile-ui-enabled):not(.page-mode-home) .mobile-me-pane {
    width: var(--pc-polish-max);
    max-width: none;
  }

  body:not(.mobile-ui-enabled) #siteHeaderZone {
    margin: 18px auto 0;
    padding: 0;
    background: transparent;
  }

  body:not(.mobile-ui-enabled) #appHeader {
    display: none !important;
  }

  body:not(.mobile-ui-enabled) .page-switch {
    min-height: 96px;
    margin: 0 auto 22px;
    padding: 16px 18px 14px;
    display: grid;
    grid-template-columns: repeat(4, max-content);
    grid-auto-rows: auto;
    align-items: center;
    justify-content: center;
    gap: 10px 12px;
    border: 1px solid var(--pc-polish-line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 18px 42px rgba(53, 73, 54, 0.08);
  }

  body:not(.mobile-ui-enabled) .page-switch::before {
    content: "四柱通明鉴";
    grid-column: 1 / -1;
    justify-self: center;
    margin: 0 0 2px;
    padding: 0 0 8px;
    border-left: 0;
    border-bottom: 2px solid rgba(200, 164, 93, 0.72);
    color: var(--pc-polish-green-deep);
    font-family: "Noto Serif SC", "Songti SC", serif;
    font-size: 1.36rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: 0;
    text-align: center;
    white-space: nowrap;
  }

  body:not(.mobile-ui-enabled) .page-switch__btn {
    justify-self: center;
    min-width: 0;
    min-height: 42px;
    padding: 0 20px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: var(--pc-polish-muted);
    box-shadow: none;
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: 0;
  }

  body:not(.mobile-ui-enabled) .page-switch__btn:hover {
    border-color: var(--pc-polish-line);
    background: #f7faf4;
    color: var(--pc-polish-green-deep);
  }

  body:not(.mobile-ui-enabled) .page-switch__btn.is-active,
  body:not(.mobile-ui-enabled) .page-switch__btn.home-console-open.is-active,
  body:not(.mobile-ui-enabled) .page-switch__btn.home-console-closed.is-active {
    border-color: transparent;
    background: linear-gradient(180deg, var(--pc-polish-green) 0%, var(--pc-polish-green-deep) 100%);
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(53, 73, 54, 0.18);
  }

  body:not(.mobile-ui-enabled):not(.page-mode-home) .mingbook-inner,
  body:not(.mobile-ui-enabled):not(.page-mode-home) .mobile-measure-pane__inner,
  body:not(.mobile-ui-enabled):not(.page-mode-home) .mobile-single-reading-pane__inner,
  body:not(.mobile-ui-enabled):not(.page-mode-home) .classics-shell,
  body:not(.mobile-ui-enabled):not(.page-mode-home) #pairPane .pair-shell,
  body:not(.mobile-ui-enabled):not(.page-mode-home) #mobileMeContent,
  body:not(.mobile-ui-enabled):not(.page-mode-home) .reading-paper.reading-wechat,
  body:not(.mobile-ui-enabled):not(.page-mode-home) .mobile-result-summary {
    border: 1px solid var(--pc-polish-line);
    border-radius: 22px;
    background: var(--pc-polish-card) !important;
    color: var(--pc-polish-text);
    box-shadow: 0 22px 52px rgba(53, 73, 54, 0.1);
  }

  body:not(.mobile-ui-enabled):not(.page-mode-home) .mingbook-inner {
    overflow: hidden;
  }

  body:not(.mobile-ui-enabled):not(.page-mode-home) .mingbook-inner .col-chart,
  body:not(.mobile-ui-enabled):not(.page-mode-home) .mingbook-inner .col-text {
    background: #ffffff;
  }

  body:not(.mobile-ui-enabled):not(.page-mode-home) :where(.ming-title, .reading-wechat__title, .reading-calligraphy-title, .mobile-measure-head__title, .mobile-single-reading-pane__title, .classics-title, .mobile-me-pane__title) {
    color: var(--pc-polish-green-deep);
    letter-spacing: 0;
  }

  body:not(.mobile-ui-enabled):not(.page-mode-home) :where(.ming-sub, .reading-wechat__sub, .reading-paper-sub, .mobile-measure-head__meta, .mobile-single-reading-pane__meta, .classics-sub, .mobile-me-pane__desc) {
    color: var(--pc-polish-muted);
  }

  body:not(.mobile-ui-enabled):not(.page-mode-home) :where(.mobile-measure-card, .classics-category-card, .mobile-me-link-btn, .pair-card) {
    border-color: var(--pc-polish-line);
    border-radius: 18px;
    background: #ffffff;
    color: var(--pc-polish-text);
    box-shadow: 0 12px 28px rgba(53, 73, 54, 0.07);
  }

  body:not(.mobile-ui-enabled):not(.page-mode-home) :where(.mobile-measure-card, .classics-category-card, .mobile-me-link-btn, .pair-card):hover {
    border-color: var(--pc-polish-line-strong);
    box-shadow: 0 18px 34px rgba(53, 73, 54, 0.1);
  }

  body:not(.mobile-ui-enabled):not(.page-mode-home) :where(#btnPaipan, #btnAiPro, #btnPairReading, #readingChatSend, .mobile-profile-create, .me-action-btn.primary) {
    border: 0;
    background: linear-gradient(180deg, var(--pc-polish-green) 0%, var(--pc-polish-green-deep) 100%);
    color: #ffffff;
    box-shadow: 0 14px 28px rgba(53, 73, 54, 0.18);
    font-weight: 800;
  }

  body:not(.mobile-ui-enabled):not(.page-mode-home) :where(#btnPaipan, #btnAiPro, #btnPairReading, #readingChatSend, .mobile-profile-create, .me-action-btn.primary):hover {
    background: linear-gradient(180deg, var(--pc-polish-green-soft) 0%, var(--pc-polish-green) 100%);
  }
}

@media (min-width: 900px) and (max-width: 1080px) {
  body:not(.mobile-ui-enabled):not(.page-mode-home) {
    --pc-polish-max: min(980px, calc(100vw - 48px));
  }

  body:not(.mobile-ui-enabled):not(.page-mode-home) .page-switch {
    padding: 0 14px;
    gap: 8px;
  }

  body:not(.mobile-ui-enabled):not(.page-mode-home) .page-switch__btn {
    padding: 0 16px;
  }
}

@media (min-width: 900px) {
  body:not(.mobile-ui-enabled).page-mode-home {
    padding-bottom: clamp(460px, 62vh, 580px) !important;
  }

  body:not(.mobile-ui-enabled).page-mode-home #homeConsolePane {
    margin-top: clamp(18px, 2.4vw, 36px) !important;
  }

  body:not(.mobile-ui-enabled).page-mode-home #homeConsolePane .console-shell.cg-shell {
    grid-template-columns: minmax(0, calc(50% - 0.7rem)) minmax(0, 1fr);
  }

  body:not(.mobile-ui-enabled).page-mode-home #homeConsolePane .console-shell.cg-shell > .mobile-home-topform-row,
  body:not(.mobile-ui-enabled).page-mode-home #homeConsolePane .console-shell.cg-shell > .mobile-home-info-list,
  body:not(.mobile-ui-enabled).page-mode-home #homeConsolePane .console-shell.cg-shell > .mobile-home-save-row,
  body:not(.mobile-ui-enabled).page-mode-home #homeConsolePane .console-shell.cg-shell > .console-actions.cg-actions {
    grid-column: 1 !important;
    max-width: 100% !important;
  }

  body:not(.mobile-ui-enabled).page-mode-home #homeConsolePane .console-shell.cg-shell > .mobile-home-topform-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
    align-items: start;
  }

  body:not(.mobile-ui-enabled).page-mode-home #homeConsolePane .console-shell.cg-shell > .mobile-home-topform-row > .cg-r1-name,
  body:not(.mobile-ui-enabled).page-mode-home #homeConsolePane .mobile-home-compact-row > .mobile-home-seg-field {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    min-width: 0;
  }

  body:not(.mobile-ui-enabled).page-mode-home #homeConsolePane .mobile-home-compact-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-items: start;
  }

  body:not(.mobile-ui-enabled).page-mode-home #homeConsolePane .mobile-home-topform-row :where(label) {
    display: block;
    min-height: 20px;
    margin: 0 0 8px;
    line-height: 20px;
  }

  body:not(.mobile-ui-enabled).page-mode-home #homeConsolePane #nameInput,
  body:not(.mobile-ui-enabled).page-mode-home #homeConsolePane .mobile-home-seg {
    width: 100%;
    min-height: 48px;
  }

  body:not(.mobile-ui-enabled).page-mode-home #homeConsolePane .mobile-home-seg {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
  }

  body:not(.mobile-ui-enabled).page-mode-home #homeConsolePane .mobile-home-seg button {
    min-width: 0;
    padding-left: 0;
    padding-right: 0;
  }

  body:not(.mobile-ui-enabled).page-mode-home #homeConsolePane .cg-actions-main-btns #btnPaipan,
  body:not(.mobile-ui-enabled).page-mode-home #homeConsolePane .cg-actions-main-btns #btnAiPro {
    max-width: 100%;
  }

  body:not(.mobile-ui-enabled).page-mode-chart #mingbookRoot .mingbook-inner {
    grid-template-columns: minmax(0, calc(50% - 0.7rem)) minmax(0, 1fr);
    justify-content: stretch;
  }

  body:not(.mobile-ui-enabled).page-mode-chart #mingbookRoot .mingbook-inner .col-chart {
    grid-column: 1;
    max-width: 100%;
  }

  body:not(.mobile-ui-enabled).page-mode-home,
  body:not(.mobile-ui-enabled).page-mode-chart,
  body:not(.mobile-ui-enabled).page-mode-measure {
    background: #f5f5f5 !important;
  }

  body:not(.mobile-ui-enabled).page-mode-home::before,
  body:not(.mobile-ui-enabled).page-mode-chart::before,
  body:not(.mobile-ui-enabled).page-mode-measure::before {
    background: #f5f5f5 !important;
    opacity: 1 !important;
  }

  body:not(.mobile-ui-enabled).page-mode-home::after,
  body:not(.mobile-ui-enabled).page-mode-chart::after,
  body:not(.mobile-ui-enabled).page-mode-measure::after {
    display: none !important;
    content: none !important;
  }
}
