/* V18 shared visual skin, based on the approved V6 jade / warm-gold palette.
 * Paint and typography only: retain existing DOM, dimensions, grids, scrolling,
 * navigation, component order, disabled behaviour, item rarity and scene art.
 * Load after the old silk files and before the V6 home / gateway integration.
 */
#game-root {
  --jade-ink: #23413f;
  --jade-muted: #536a61;
  --jade-paper: #f1eddc;
  --jade-line: #a99e7b;
  --jade-dark: #19494d;
  --jade-deep: #15383f;
  --jade-gold: #d7b875;
  --jade-card: linear-gradient(135deg, #f5efde, #e4eadc);
  --jade-selected: linear-gradient(135deg, #286265, #19434a);
  --silk-ink: var(--jade-ink);
  --silk-muted: var(--jade-muted);
  --silk-line: var(--jade-line);
  --silk-page-paper: linear-gradient(135deg, #f5efdf, #e3e9db);
  --silk-paper-grain: linear-gradient(transparent, transparent);
}

/* Existing page frames and dialog corners remain in their original places. */
#game-root .page-panel:not(.cultivate-panel):not(.is-scene-mode),
#game-root .attribute-modal__content,
#game-root dialog,
#game-root .companion-confirm-dialog {
  background-color: var(--jade-paper);
  border-color: var(--jade-line);
  color: var(--jade-ink);
  box-shadow: inset 0 0 0 2px #fff8e773, 0 4px 15px #102e3726;
}
#game-root .page-panel:not(.cultivate-panel):not(.is-scene-mode),
#game-root .attribute-modal__content,
#game-root dialog {
  --text-muted: var(--jade-muted);
}
#game-root .page-panel:not(.cultivate-panel) h2,
#game-root .attribute-modal__content h2,
#game-root dialog h2 {
  color: #244b49 !important;
  font-family: KaiTi, STKaiti, "Noto Serif SC", "Songti SC", SimSun, serif;
}
#game-root .page-panel:not(.cultivate-panel) h3,
#game-root dialog h3 {
  color: #2a4b43;
  font-family: KaiTi, STKaiti, "Noto Serif SC", "Songti SC", SimSun, serif;
}
#game-root .page-panel:not(.cultivate-panel) button,
#game-root dialog button,
#game-root .companion-confirm-dialog button {
  font-family: KaiTi, STKaiti, "Noto Serif SC", "Songti SC", SimSun, serif;
}
#game-root .page-panel:not(.cultivate-panel) .primary-button:not(:disabled),
#game-root dialog .primary-button:not(:disabled),
#game-root .companion-confirm-dialog .primary-button:not(:disabled) {
  background: var(--jade-selected) !important;
  border-color: #bda063 !important;
  color: #fff0c9 !important;
  box-shadow: inset 0 0 0 2px #d1b77829, 0 2px 4px #163e4026;
  text-shadow: 0 1px 1px #143238;
}
#game-root .page-panel:not(.cultivate-panel) .secondary-button:not(:disabled),
#game-root dialog .secondary-button:not(:disabled),
#game-root .companion-confirm-dialog .secondary-button:not(:disabled) {
  background: linear-gradient(#f5f1e4, #dbe6d9);
  border-color: #8faaa0;
  color: #284c49;
  box-shadow: inset 0 0 0 2px #fffbed66;
  text-shadow: none;
}
#game-root .page-panel:not(.cultivate-panel) .danger-button:not(:disabled),
#game-root dialog .danger-button:not(:disabled),
#game-root .companion-confirm-dialog .danger-button:not(:disabled) {
  background: linear-gradient(#965644, #784033);
  border-color: #b88465;
  color: #fff0dc;
  text-shadow: 0 1px #6f382c;
}
#game-root dialog::backdrop {
  background: #0c2937ad;
}
#game-root .game-dialog-mask,
#game-root .companion-confirm-overlay {
  background-color: #0c2937a8;
}

/* Navigation controls: same rows, same hit areas and same disabled state. */
#game-root :is(.cave-module-button,.shop-tab,.shop-category-button,
 .kungfu-category-button,.rank-tab,.spirit-beast-tabs button,.companion-tabs button,
 [data-artifact-tab],.bag-category-button,.dungeon-category-button,
 .newcomer-content-tabs button,.newcomer-day-tab,.sect-shop-tab,
 .sect-task-tab,.black-market-tab,.black-market-choice):not(:disabled) {
  background: linear-gradient(#f5f0df, #d9e5d8);
  border-color: #96aba0;
  color: #30514b;
  box-shadow: inset 0 0 0 2px #fff9e766;
}
#game-root :is(.cave-module-button,.shop-tab,.shop-category-button,
 .kungfu-category-button,.rank-tab,.spirit-beast-tabs button,.companion-tabs button,
 [data-artifact-tab],.bag-category-button,.dungeon-category-button,
 .newcomer-content-tabs button,.newcomer-day-tab,.sect-shop-tab,
 .sect-task-tab,.black-market-tab,.black-market-choice):is(.is-active,.is-selected,[aria-selected="true"],[aria-pressed="true"]):not(:disabled) {
  background: var(--jade-selected) !important;
  border-color: #bfa66b !important;
  color: #ffedbf !important;
  box-shadow: inset 0 0 0 2px #d7b87538;
}
#game-root .cave-module-button.is-active:not(:disabled) small {
  color: #e1e9d2;
}
#game-root :is(.bag-categories,.shop-tabs) {
  background-color: #d5dfd0;
}

/* Existing data surfaces use warm paper, with jade borders instead of gray. */
#game-root :is(.spirit-formation-material,.shop-currency,.shop-empty,
 .physique-panel-section,.physique-framework-block,.physique-advance-section,
 .physique-subpanel-title,.physique-advance-node,.physique-advance-material,
 .physique-refinement-summary,.physique-refinement-row,.physique-refine-confirm-detail,
 .physique-rules-list section,.artifact-rules-list section,
 .artifact-cultivation-card,.artifact-cultivation-summary,.artifact-detail-section,
 .artifact-cultivation-header,.artifact-attributes-panel,.artifact-progress,.artifact-cost-row,
 .companion-content,.companion-empty-state,.companion-attribute-grid > div,
 .companion-current-portrait,.companion-known-portrait,
 .companion-attribute-section > h3,.companion-kungfu-section > h3,.companion-equipment-section > h3,
 .companion-cultivation-progress,.spirit-beast-attribute-grid > div,
 .kungfu-card__progression,.kungfu-card__current-effect,
 .formation-picker-position,.formation-picker-empty,.dungeon-sweep-compact,
 .settings-section,.spirit-root-summary-card,.spirit-formation-upgrade,
 .newcomer-task-row,.online-reward-task,.kungfu-card,.companion-known-card,
 .spirit-beast-profile,.spirit-beast-attributes,.dungeon-card,.attribute-basic-section,
 .attribute-equipment-section,.attribute-kungfu-section,.alchemy-control-panel,.forging-control-panel,
 .cave-operation-bar,.cave-building-card,.attribute-summary-grid,.reserved-slot-card,
 .physique-origin-slot,.physique-origin-output,.physique-origin-option,
 .cultivation-speed-detail-list > div,.async-duel-stats > div,
 .mail-list-summary,.mail-detail-heading,.mail-detail-content,.mail-reward-panel,
 .network-announcement-dialog__body,.bag-item-meta,.entitlement-benefits,
 .world-chat-announcement-list,.world-chat-log,.world-chat-composer,.sect-task-view,
 .dungeon-fixed-header,.black-market-listing-panel,.black-market-listing-section,
 .black-market-filter-section,.black-market-purchase-detail,.slot-selection-context,
 .slot-selection-board,.bag-batch-sell-bar) {
  background: var(--jade-card);
  border-color: #a7b3a0;
  color: #2c463d;
  box-shadow: inset 0 0 0 2px #fff7e54d;
}
#game-root :is(.world-chat-announcement,.world-chat-message,.sect-kungfu-row,.sect-duty-card,
 .sect-arena-phase,.sect-arena-match-card,.sect-arena-competitor,
 .sect-arena-match-card__result,.sect-arena-advancement,.sect-arena-advancement-name,
 .sect-arena-final-result-row,.sect-arena-ranking-row,.rank-table__row) {
  background: linear-gradient(135deg, #f7f2e3, #e2eadb);
  border-color: #a9b5a1;
  color: #2d453d;
  box-shadow: inset 0 0 0 2px #fff9ec59;
}
#game-root :is(.world-chat-message.is-current-player,.sect-duty-card.is-running,
 .rank-table__row.is-current-player,.equipment-choice--current) {
  background: linear-gradient(135deg, #e8eacb, #c9dfcf);
  border-color: #799c88;
}
#game-root .sect-page.is-scene-mode > .feature-page-heading {
  background-color: #e5ecdd;
  border-color: #ac9a70;
}
#game-root :is(.sect-position-badge,.sect-contribution-badge) {
  color: #305148;
}
#game-root :is(.sect-arena,.sect-arena__content,.sect-arena-view,.sect-arena-competition-view) {
  background-color: #e5ebdb;
  border-color: #a7b3a0;
}

/* Item artwork and rarity borders retain all original metadata and colors. */
#game-root :is(.bag-slot-grid,.shop-product-list) {
  background: #d9e2d2;
  box-shadow: 0 0 0 4px #bdcbb666;
}
#game-root :is(.bag-slot,.shop-product-tile) {
  background-color: #f3efdf;
}
#game-root .bag-slot--empty {
  background-color: #e0e7d8;
}
#game-root .bag-slot__name {
  background-color: #f0ecdb;
}
#game-root .bag-slot__count {
  background-color: #284f4b;
  color: #fff1c9;
}
#game-root :is(.bag-slot__icon,.shop-product-tile__art) {
  background-color: #ccd9c9;
}
#game-root :is(.alchemy-material-slot,.forging-material-slot,.forging-core-slot,
 .alchemy-selector-button,.alchemy-selection-option) {
  background-color: #e6eddd;
  border-color: #9dab95;
}
#game-root :is(.alchemy-product-slot,.forging-product-slot,
 .alchemy-material-slot__art,.forging-material-slot__art,.forging-core-slot__art,
 .reserved-slot-card__icon,.slot-selection-context__icon,.cave-building-card__icon,
 .spirit-beast-portrait,.spirit-beast-roster-item .spirit-beast-roster-art) {
  background-color: #f2eeda;
  color: #36574b;
}
#game-root :is(.alchemy-product-slot,.forging-product-slot).is-ready {
  background-color: #f5e9cafa;
  border-color: #b09250;
  box-shadow: 0 0 0 2px #e3c47a4d;
}
#game-root .black-market-listing-preview {
  background: #e1e9d7;
  border-color: #9fae91;
}
#game-root .black-market-item-choice.is-selected {
  background: #d3e3cd;
  box-shadow: inset 0 0 0 2px #789780;
}
#game-root .equipment-choice {
  background-color: #f1efdd;
}

/* Form fields stay in their existing grids and retain validation styling. */
#game-root .page-panel:not(.cultivate-panel) :is(input[type="text"],input[type="number"],select,textarea),
#game-root dialog :is(input[type="text"],input[type="number"],select,textarea) {
  background-color: #fbf7e9;
  border-color: #96aa98;
  color: #29483f;
  accent-color: #2d7b70;
  caret-color: #2d7b70;
}
#game-root .world-chat-composer textarea {
  background-color: #fbf7e9 !important;
}
#game-root :is(.page-panel,dialog) :is(input,textarea)::placeholder {
  color: #687666;
}
#game-root :is(.page-panel,dialog) :is(button,input,select,textarea):focus-visible {
  outline-color: #ab884c;
}
#game-root :is(.attribute-modal__close,.dialog-close) {
  color: #33554c;
  border-color: #9baa92;
}

/* Progress coloration is scoped to non-combat progress only. */
#game-root :is(.artifact-progress__bar,.cave-cycle-progress,
 .companion-cultivation-progress progress,.kungfu-card progress) {
  background-color: #b4cbb8;
  accent-color: #458a70;
}
#game-root :is(.cave-cycle-progress,.companion-cultivation-progress progress,
 .kungfu-card progress)::-webkit-progress-bar {
  background-color: #bbcdbb;
}
#game-root :is(.cave-cycle-progress,.companion-cultivation-progress progress,
 .kungfu-card progress)::-webkit-progress-value {
  background: linear-gradient(90deg, #4c9c7b, #c7d998);
}
#game-root :is(.cave-cycle-progress,.companion-cultivation-progress progress,
 .kungfu-card progress)::-moz-progress-bar {
  background: linear-gradient(90deg, #4c9c7b, #c7d998);
}

/* Confirmations remain opaque and readable. Do not dim meaningful warning text. */
#game-root .companion-confirm-overlay .companion-confirm-dialog {
  background: var(--jade-card);
  border-color: #aa946c;
}
#game-root .companion-confirm-overlay .companion-confirm-dialog h3 {
  color: #29483f;
}
#game-root .companion-confirm-overlay .companion-confirm-dialog p {
  color: #385047;
}
#game-root .companion-confirm-overlay .companion-confirm-actions .secondary-button {
  background: linear-gradient(#f5f1e4, #dbe6d9);
  color: #294b43;
}
#game-root .companion-confirm-overlay .companion-confirm-actions .danger-button {
  background: linear-gradient(#965644, #784033);
  color: #fff0dc;
}

/* Preserve success, error, quality and unavailable colors from the existing CSS.
 * No generic descendant color rule, no battle-unit/scene selector, no opacity
 * override, no global button state reset, and no changes to selected item names.
 */

/* Seller listings use the same light paper as the surrounding market panels. */
#game-root [data-role="black-market-own-list"] .black-market-row {
  background: var(--jade-card, linear-gradient(135deg, #f5efde, #e4eadc));
  border-color: #b3a681;
  box-shadow: inset 0 1px 0 #fff9e980;
  color: #23413f;
}
#game-root [data-role="black-market-own-list"] .black-market-row small {
  color: #536a61;
}
