/* Frontend-only themes. Keep the original stylesheet as the dark baseline. */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-shrink: 0;
  min-height: 38px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.5;
  white-space: nowrap;
  touch-action: manipulation;
  transition: background-color .18s, border-color .18s;
}
.theme-toggle:hover { background: var(--white); }
.site-header .header-actions { min-width: 0; }
.header-account > span:last-child { max-width: 9em; overflow: hidden; text-overflow: ellipsis; }

html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="light"] {
  color-scheme: light;
  --paper: #fff;
  --white: #f5f6f8;
  --ink: #202129;
  --muted: #646570;
  --line: #e1e3e8;
  --accent: #ffd43b;
  --accent-hover: #ffdf63;
  --accent-soft: #fff7db;
  --sage: #806012;
  --theme-accent-text: #806012;
  --theme-control-border: #848792;
}
html[data-theme="light"] :is(button,a,input,textarea,select):focus-visible {
  outline-color: var(--theme-accent-text);
}

/* Navigation and common UI surfaces. */
html[data-theme="light"] .site-header { background: #fff; border-color: var(--line); }
html[data-theme="light"] .desktop-nav a { color: #50515b; }
html[data-theme="light"] .desktop-nav a.active { color: var(--theme-accent-text); }
html[data-theme="light"] .desktop-nav a.active:after { background: var(--theme-accent-text); }
html[data-theme="light"] .header-search,
html[data-theme="light"] .search-form { background: #f5f6f8; border-color: var(--theme-control-border); }
html[data-theme="light"] input::placeholder,
html[data-theme="light"] textarea::placeholder { color: #6b6d78; opacity: 1; }
html[data-theme="light"] .avatar-small { background: #ece7dd; color: #65502a; }
html[data-theme="light"] .theme-toggle { border-color: var(--theme-control-border); }
html[data-theme="light"] .button-secondary,
html[data-theme="light"] .button-secondary:not(.button),
html[data-theme="light"] .account-form .button-secondary,
html[data-theme="light"] .security-session > .button {
  background: #f2f3f6; color: #42444e; border-color: var(--theme-control-border);
}
html[data-theme="light"] .button-secondary:hover:not(:disabled),
html[data-theme="light"] .button-secondary:not(.button):hover:not(:disabled),
html[data-theme="light"] .account-form .button-secondary:hover:not(:disabled),
html[data-theme="light"] .security-session > .button:hover:not(:disabled) {
  background: #e8eaef; color: #202129; border-color: #747783;
}
html[data-theme="light"] :is(.eyebrow,.section-icon,.search-form button,.library-tools strong,.empty-state > svg,.preview-duration) {
  color: var(--theme-accent-text);
}
html[data-theme="light"] :is(.text-link,.channel-strip a,.group-actions button,.group-stats,.tabs button) { color: #5c5e68; }
html[data-theme="light"] :is(.text-link:hover,.channel-strip a.active,.group-actions button.active,.tabs button.active,.card-heading h3 a:hover,.save-button.active) {
  color: var(--theme-accent-text);
}
html[data-theme="light"] .tabs button.active:after { background: var(--theme-accent-text); }
html[data-theme="light"] :is(.channel-note,.card-subtitle,.card-meta,.save-button,.tabs button span,.preview-details-list) { color: var(--muted); }
html[data-theme="light"] :is(.library-tools,.daily-promo,.empty-state) { background: #f5f6f8; color: var(--muted); }
html[data-theme="light"] .library-tools span:last-child { color: var(--muted); }
html[data-theme="light"] .pagination button { background: #f5f6f8; color: var(--ink); border-color: var(--theme-control-border); }
html[data-theme="light"] .pagination button.active { background: var(--accent); color: #241e0d; border-color: #9b7c19; }
html[data-theme="light"] .pagination button:hover:not(:disabled) { border-color: var(--theme-accent-text); }
html[data-theme="light"] :is(.tag,.tag-sage,.tag-accent) { background: #fff4ce; color: #806012; border-color: #d4bd7d; }
html[data-theme="light"] .notice { background: #fbf9f1; color: #5f5c50; border-color: #ded6c0; border-left-color: #9b741c; }
html[data-theme="light"] .notice-warning { background: #fff7e7; color: #77531c; border-color: #e3c98e; }
html[data-theme="light"] .notice a { color: #806012; }
html[data-theme="light"] .form-error { color: #9b3329; }
html[data-theme="light"] :is(.field label,.account-form .field label) { color: #42444e; }
html[data-theme="light"] :is(.field input,.field textarea,.field select,.account-form .field input,.account-form .field textarea) {
  background: #fff; color: var(--ink); border-color: var(--theme-control-border);
}
html[data-theme="light"] .account-form .field input::placeholder,
html[data-theme="light"] .account-form .field textarea::placeholder { color: #6b6d78; }
html[data-theme="light"] .account-form .field input:focus,
html[data-theme="light"] .account-form .field textarea:focus { border-color: #806012; }
html[data-theme="light"] .account-form .field input[type="file"]::file-selector-button { color: #42444e; border-right-color: var(--line); }
html[data-theme="light"] .check-label input { accent-color: #806012; }

/* Match the approved light Hero without filtering or changing its source image. */
html[data-theme="light"] .hero-banner { background: #e8edef; }
html[data-theme="light"] .hero-shadow {
  background: linear-gradient(90deg,#fff 0%,#fffffff0 14%,#ffffffa8 36%,#ffffff08 65%,#ffffff35 100%),
    linear-gradient(0deg,#fff 0%,#ffffff25 35%,transparent 65%);
}
html[data-theme="light"] .hero-title { color: #202129; text-shadow: none; }
html[data-theme="light"] .hero-meta { color: #535763; }
html[data-theme="light"] .hero-meta .vip-word { color: #806012; }
html[data-theme="light"] .hero-description { color: #4c535b; }
html[data-theme="light"] .hero-picks button { color: #383c44; background: #ffffffcf; }
html[data-theme="light"] .hero-picks button.active { color: #806012; background: #fffffff0; }
html[data-theme="light"] .hero-dots button::before { background: #6b6e75; }
html[data-theme="light"] .hero-dots button.active::before { background: #806012; }
html[data-theme="light"] .hero-carousel-control { color: #343640; background: #ffffffed; border-color: var(--theme-control-border); }
html[data-theme="light"] .recommendation-carousel-control { color: #42444e; background: #fff; border-color: var(--theme-control-border); }
html[data-theme="light"] .carousel-control:hover { color: #806012; border-color: #806012; }
html[data-theme="light"] .recommendation-strip > .recommendation-card { border-color: var(--line); }
html[data-theme="light"] .recommendation-strip > a.recommendation-card:hover { border-color: #806012; }
html[data-theme="light"] .weekly-update { background: #fff9e7; color: #64605a; border-color: #e6d9b2; }
html[data-theme="light"] .weekly-update :is(svg,strong) { color: #806012; }
html[data-theme="light"] .vip-band { background: #fff8e2; color: #6d5421; border-color: #ead9a6; }
html[data-theme="light"] .vip-band-mark { color: #806012; }
html[data-theme="light"] .vip-band h3 { color: #4b3c21; }
html[data-theme="light"] .vip-band p { color: #77633e; }
html[data-theme="light"] :is(.asset-placeholder,.daily-preview-placeholder) { background: linear-gradient(135deg,#eceef2,#f5f6f8); color: #626570; }
html[data-theme="light"] .daily-preview-placeholder small { color: var(--muted); }
html[data-theme="light"] .daily-promo-empty { border-color: var(--line); }

/* Resource type controls are UI; protected-media overlays remain untouched. */
html[data-theme="light"] .media-type-tabs { background: #f5f6f8; border-color: #c8cbd3; box-shadow: none; }
html[data-theme="light"] .media-type-tabs button { background: #fff; color: #42444e; border-color: var(--theme-control-border); }
html[data-theme="light"] .media-type-tabs button:hover { color: #202129; border-color: #806012; }
html[data-theme="light"] .media-type-tabs button.active { background: #ffd43b; color: #241e0d; border-color: #806012; box-shadow: none; }
html[data-theme="light"] .media-type-tabs .media-type-icon { color: #806012; }
html[data-theme="light"] .media-type-tabs button.active .media-type-icon { color: #241e0d; }
html[data-theme="light"] .media-type-tabs .media-type-count { color: #555762; background: #eef0f4; }
html[data-theme="light"] .media-type-tabs button.active .media-type-count { color: #241e0d; background: #ffec9b; }

/* Membership, checkout summaries and payment state. No payment logic changes. */
html[data-theme="light"] :is(.page-heading .page-title,.section-heading h2,.price-panel .plan-option h2,.order-summary h2,.payment-result h2) { color: var(--ink); }
html[data-theme="light"] :is(.page-heading .page-intro,.field-hint,.quiet-label,.price-period,.row-metadata dt,.row-metadata dd,.plan-number) { color: var(--muted); }
html[data-theme="light"] .plan-option { background: #fff; border-color: #cdd0d8; }
html[data-theme="light"] .plan-option:hover { border-color: #9b7c26; }
html[data-theme="light"] .plan-option.is-recommended { background: #fffcf2; border-color: #b49339; box-shadow: inset 0 0 0 1px #b49339; }
html[data-theme="light"] .plan-recommendation { color: #684e0c; background: #fff0bb; }
html[data-theme="light"] :is(.price-panel .plan-option .plan-description,.price-panel .plan-option .checklist,.price-panel .plan-option .plan-purchase-note) { color: var(--muted); }
html[data-theme="light"] .price-panel .plan-option .plan-price { color: var(--ink); }
html[data-theme="light"] .row-metadata { border-color: var(--line); }
html[data-theme="light"] .checklist li > svg { color: #806012; }
html[data-theme="light"] .plan-purchase-actions .plan-pay-wechat { background: #f5f3e9; color: #68500e; border-color: #9b8546; }
html[data-theme="light"] .plan-purchase-actions .plan-pay-wechat:hover:not(:disabled) { background: #fff0bd; color: #57420b; border-color: #806012; }
html[data-theme="light"] .plan-pay-wechat .payment-logo { color: #68500e; background: #e9dfb8; }
html[data-theme="light"] .plan-notes { border-color: var(--line); }
html[data-theme="light"] .price-panel .plan-notes h3 { color: #42444e; }
html[data-theme="light"] .price-panel .plan-notes p { color: var(--muted); }
html[data-theme="light"] .plan-notes > .text-link { color: #806012; }
html[data-theme="light"] .order-summary { background: #f8f9fb; color: var(--ink); border-color: var(--line); }
html[data-theme="light"] :is(.summary-list > div,.summary-total) { border-color: var(--line); }
html[data-theme="light"] .summary-list dt { color: var(--muted); }
html[data-theme="light"] .summary-list dd { color: #42444e; }
html[data-theme="light"] .summary-total strong { color: #806012; }
html[data-theme="light"] .order-summary .form-section-title { color: #42444e; }
html[data-theme="light"] .payment-method { background: #fff; color: #50525d; border-color: var(--theme-control-border); }
html[data-theme="light"] .payment-method.is-selected { background: #fff9e7; color: #68500e; border-color: #806012; }
html[data-theme="light"] .payment-method[disabled] { background: #f1f2f5; border-color: #cdd0d8; }
html[data-theme="light"] .payment-logo { background: #eaecf0; color: #50525d; }
html[data-theme="light"] .plan-pay-alipay .payment-logo { background: #eabb20; color: #302711; }
html[data-theme="light"] .payment-method.is-selected .payment-logo { background: #efe1ac; color: #68500e; }
html[data-theme="light"] .choice-dot { border-color: #80838e; }
html[data-theme="light"] .payment-method.is-selected .choice-dot { border-color: #806012; background: #fff; }
html[data-theme="light"] .order-summary .notice { background: #fff4ce; color: #68500e; }
html[data-theme="light"] .payment-result-layout > .payment-result { background: #fff; border-color: var(--line); }
html[data-theme="light"] :is(.payment-result .page-intro,.payment-result .payment-result-detail) { color: var(--muted); }
html[data-theme="light"] .payment-state-icon { background: #fff3c4; color: #806012; }
html[data-theme="light"] :is(.payment-state-icon.failed,.payment-state-icon.refunded) { background: #fcebe5; color: #9b4230; }
html[data-theme="light"] :is(.payment-state-icon.unknown,.payment-state-icon.canceled) { background: #eef0f4; color: #646570; }
html[data-theme="light"] .status-label { background: #fff3c4; color: #78550b; }
html[data-theme="light"] :is(.status-label.processing,.status-label.unknown) { background: #f6efda; color: #735d22; }
html[data-theme="light"] :is(.status-label.resolved,.status-label.paid) { background: #e7f4eb; color: #28613d; }
html[data-theme="light"] :is(.status-label.failed,.status-label.refunded) { background: #fcebe5; color: #9b4230; }
html[data-theme="light"] :is(.status-label.canceled,.status-label.ignored) { background: #eef0f4; color: #5c5e68; }

/* Authentication and personal pages. Editorial-image copy stays white. */
html[data-theme="light"] .auth-layout.split-layout { background: #fff; border-color: var(--line); }
html[data-theme="light"] .auth-form-panel { background: #fff; }
html[data-theme="light"] .tab-bar { border-color: var(--line); }
html[data-theme="light"] .tab-bar .tab { color: var(--muted); }
html[data-theme="light"] .tab-bar .tab.active { color: #806012; }
html[data-theme="light"] .tab-bar .tab.active:after { background: #806012; }
html[data-theme="light"] :is(.account-form .field .helper-text,.auth-form-panel .account-form > .helper-text,.form-meta .helper-text,.check-label,.auth-back) { color: var(--muted); }
html[data-theme="light"] :is(.form-meta .text-link,.check-label .text-link,.account-form > .text-link) { color: #806012; }
html[data-theme="light"] .account-sidebar { background: #f8f9fb; border-color: var(--line); }
html[data-theme="light"] .account-avatar { background: #fff0bb; color: #806012; }
html[data-theme="light"] .account-identity strong { color: var(--ink); }
html[data-theme="light"] .account-identity span { color: var(--muted); }
html[data-theme="light"] .account-sidebar .account-nav-item { color: #555762; }
html[data-theme="light"] .account-sidebar .account-nav-item:hover { background: #eef0f4; color: var(--ink); }
html[data-theme="light"] .account-nav-item > svg:last-child { color: #6b6d78; }
html[data-theme="light"] .account-sidebar .account-nav-item.active { color: #806012; background: #fff3ce; }
html[data-theme="light"] .account-sidebar .account-nav-item.active > svg { color: #806012; }
html[data-theme="light"] .account-sidebar .logout-link { color: var(--muted); }
html[data-theme="light"] :is(.account-main .section-header h2,.points-balance ~ .section-header h2,.point-package h3,.feedback-layout .section-header h2) { color: var(--ink); }
html[data-theme="light"] .account-main .section-header .text-link { color: #806012; }
html[data-theme="light"] .membership-summary { background: #fff8e2; border-color: #dbc98e; }
html[data-theme="light"] .account-main .membership-summary h3 { color: #68500e; }
html[data-theme="light"] .membership-summary :is(p,.helper-text) { color: #77633e; }
html[data-theme="light"] .membership-summary.is-expired { background: #f1f2f5; border-color: #cdd0d8; }
html[data-theme="light"] .account-main .membership-summary.is-expired h3 { color: #50525d; }
html[data-theme="light"] .membership-summary.is-expired :is(p,.helper-text) { color: var(--muted); }
html[data-theme="light"] .account-links > a { background: #fff; color: #555762; border-color: var(--line); }
html[data-theme="light"] .account-links > a:hover { border-color: #806012; }
html[data-theme="light"] .account-links > a > svg:first-child { color: #806012; }
html[data-theme="light"] .account-links > a > svg:last-child { color: #6b6d78; }
html[data-theme="light"] .account-links strong { color: var(--ink); }
html[data-theme="light"] :is(.profile-form,.security-block,.security-session,.points-balance,.point-package,.table-wrap,.feedback-layout > div) { background: #fff; border-color: var(--line); }
html[data-theme="light"] :is(.avatar-editor .helper-text,.form-actions .helper-text,.security-block > .helper-text,.security-session p) { color: var(--muted); }
html[data-theme="light"] .security-block .list-row > div > svg { color: #806012; }
html[data-theme="light"] .security-block .list-row h3 { color: #42444e; }
html[data-theme="light"] .security-block .list-row p { color: var(--muted); }
html[data-theme="light"] .security-block > .notice { background: #fff4ce; color: #68500e; }
html[data-theme="light"] :is(.points-balance .eyebrow,.points-balance strong small,.points-balance p,.point-package .eyebrow,.point-package h3 small) { color: var(--muted); }
html[data-theme="light"] :is(.points-balance strong,.package-price) { color: #806012; }
html[data-theme="light"] .points-balance > .text-link { color: #806012; }
html[data-theme="light"] .points-table th { color: var(--muted); border-color: var(--line); }
html[data-theme="light"] .points-table td { color: #555762; border-color: var(--line); }
html[data-theme="light"] .points-table td strong { color: #42444e; }
html[data-theme="light"] .points-table td span { color: var(--muted); }
html[data-theme="light"] .points-table .positive { color: #28613d; }
html[data-theme="light"] .points-table .negative { color: #9b4230; }
html[data-theme="light"] :is(.points-history-note,.feedback-layout .section-header p,.feedback-record-meta time,.feedback-record p,.feedback-record p > span,.feedback-back) { color: var(--muted); }
html[data-theme="light"] .feedback-record { border-color: var(--line); }
html[data-theme="light"] .feedback-record h3 { color: #42444e; }

/* Normal dialogs are light; media dialogs and all image/video pixels are not. */
html[data-theme="light"] .modal:not(.media-lightbox) { background: #fff; color: var(--ink); border-color: var(--line); box-shadow: 0 20px 90px #0005; }
html[data-theme="light"] .modal-player-note { background: #eef0f4; color: var(--muted); }
html[data-theme="light"] .modal.media-lightbox { background: #030304; color: #fff; }
html[data-theme="light"] .media-lightbox .button-secondary { background: #2b2b32; color: #dddde4; border-color: #6c6c78; }
html[data-theme="light"] .media-lightbox .button-secondary:hover:not(:disabled) { background: #37373f; color: #fff; }
html[data-theme="light"] .media-lightbox :is(button,a):focus-visible { outline-color: #ffd43b; }
html[data-theme="light"] .site-footer { background: #f6f7f9; border-color: var(--line); }
html[data-theme="light"] .footer-brand { color: #555762; }
html[data-theme="light"] .site-footer > :is(p,div,small) { color: var(--muted); }
html[data-theme="light"] .mobile-nav { background: #ffffffed; border-color: #c8cbd3; }
html[data-theme="light"] .mobile-nav a { color: #646570; }
html[data-theme="light"] .mobile-nav a.active { color: #806012; }
html[data-theme="light"] .toast { background: #30323a; color: #fff; box-shadow: 0 8px 25px #0003; }

@media (max-width: 1120px) {
  .site-header .header-search { display: none; }
  .site-header { gap: 18px; }
  .theme-toggle { margin-left: auto; }
  .site-header .header-actions { margin-left: 0; gap: 10px; }
}
@media (max-width: 760px) {
  .site-header { gap: 10px; }
  .theme-toggle { min-height: 36px; padding: 6px 8px; font-size: 11px; gap: 5px; }
  .site-header .header-actions { gap: 7px; }
  .header-account > span:last-child { max-width: 4.5em; }
  html[data-theme="light"] .hero-shadow {
    background: linear-gradient(0deg,#fff 0%,#fffffff2 16%,#ffffffc4 42%,#ffffff30 80%,#ffffff0a 100%);
  }
}
@media (max-width: 380px) {
  .theme-toggle { width: 36px; padding: 6px; }
  .theme-toggle [data-theme-label] { display: none; }
  /* Membership remains available in the persistent mobile navigation. */
  .header-actions > .button[href="#plans"] { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .theme-toggle { transition: none; }
}
