/* adventure-surfaces.css — Adventure Preview: SVG art slots, village + Skins frames,
   secondary surfaces. Load after adventure.css, before appearance-picker.css. */

/* ---------- Art slots: original SVG children stay unless Adventure AND image loaded ---------- */
svg .adventure-svg-art { display: none; }
body[data-theme="adventure"] svg[data-adventure-art-ready="true"] > .adventure-svg-art { display: inline; pointer-events: none; }
body[data-theme="adventure"] svg[data-adventure-art-ready="true"] > :not(.adventure-svg-art) { display: none; }
body[data-theme="adventure"] svg[data-adventure-art-ready="true"] { overflow: visible; fill: none; }
/* Wallet art: brick icon must not be hue-shifted once the real raster is in */
html body[data-theme="adventure"][data-theme] #gameApp svg.icon-brick[data-adventure-art-ready="true"],
html body[data-theme="adventure"][data-theme] .candy-map svg.icon-brick[data-adventure-art-ready="true"] { filter: drop-shadow(0 2px 0 #4a083066); }
html body[data-theme="adventure"][data-theme] #gameApp svg#walletCoin[data-adventure-art-ready="true"] { filter: drop-shadow(0 2px 0 #8a500066); }
/* Cooling chests: grey raster too (cadence/classes owned by game.js) */
html body[data-theme="adventure"][data-theme] #gameApp .btn-bonus:is(.is-cooling, :disabled) svg[data-adventure-art-ready="true"] { filter: grayscale(1) contrast(.9); opacity: .78; }
@media (forced-colors: active) {
  body[data-theme="adventure"] svg[data-adventure-art-ready="true"] > .adventure-svg-art { display: none; }
  body[data-theme="adventure"] svg[data-adventure-art-ready="true"] > :not(.adventure-svg-art) { display: revert; }
}

/* ---------- Secondary surfaces: no candy-pink defaults ---------- */
html body[data-theme="adventure"][data-theme] #gameApp .footer-section {
  background: linear-gradient(180deg, #ffffffa0, #ffffff70); border: 3px solid #fff; border-radius: 20px; padding: 12px; box-shadow: 0 5px 0 #1581b4;
}
html body[data-theme="adventure"][data-theme] #gameApp .community-skeleton { background: linear-gradient(90deg, #f3dcaa, #fff4d8, #f3dcaa); }
html body[data-theme="adventure"][data-theme] #gameApp .chat-placeholder { border-color: #b28a5a; background: #c46a2a14; }
html body[data-theme="adventure"][data-theme] #gameApp .chat-placeholder span { background: #b28a5a; }
html body[data-theme="adventure"][data-theme] #gameApp .community-list > * { color: var(--av-ink); }
html body[data-theme="adventure"][data-theme] #gameApp .community-badge,
body[data-theme="adventure"] .community-dialog .community-badge { background: var(--av-wood-deep); color: var(--av-cream); }
html body[data-theme="adventure"][data-theme] #gameApp .bet-status-row .selection-tracker { background: #93125d; }
html body[data-theme="adventure"][data-theme] #gameApp .is-level-highlight,
html body[data-theme="adventure"][data-theme] #gameApp .level-up-badge { background: var(--av-gold); color: var(--av-gold-ink); }


/* =====================================================================
   Map / village / Skins frames — Adventure only.
   Wrapped in (forced-colors: none) so map.css / board-skins.css forced-colour
   rules keep winning. Prefix #districtMap (+ #mapSkins) out-ranks
   `body .candy-map #mapSkins …` and `.candy-village …`. Scenes, map art,
   building art and skin previews are never filtered.
   ===================================================================== */
/* Token remap: every existing map/skin/village rule picks up wood/gold/cream/turquoise */
html body[data-theme="adventure"] #districtMap,
html body[data-theme="adventure"] #districtMap #mapSkins,
html body[data-theme="adventure"] #districtMap #mapOverview,
html body[data-theme="adventure"] .map-confirm {
  --map-font: var(--av-font);
  font-family: var(--av-font);
  --map-ink: #4e2108; --map-ink-soft: #6a3a14; --map-cream: #fff4d8; --map-cream-2: #f3dcaa;
  --map-rasp: #c42b22; --map-rasp-dark: #8a1a16; --map-tang: #ffc934; --map-tang-dark: #a8590d;
  --map-mint: #2fc4ef; --map-mint-dark: #0e5f8c; --map-gold: #ffc934; --map-focus: #10305a;
  --sk-grape: #8a3f14; --sk-grape-2: #c46a2a; --sk-grape-rim: #4e2108; --sk-cream: #fff4d8;
  --sk-ink: #3a1a06; --sk-ink-soft: #5a3410; --sk-rasp: #93125d; --sk-gold: #ffc934;
  --v-focus: #10305a; --v-accent-dark: #8a3f14; --v-deep-dark: #4e2108; --v-cream: #fff4d8;
}
@media (forced-colors: none) {
  html body[data-theme="adventure"] section#districtMap.candy-map:not([hidden]) {
    background-color: #2fc4ef !important;
    background-image: radial-gradient(140% 20% at 50% 106%, #fffaf0 60%, transparent 61%), linear-gradient(180deg, #7fe3ff, #2fc4ef 55%, #1a9fd6) !important;
    color: #3a1a06 !important;
  }
  /* --- Toolbars: wood plank with gold rail --- */
  html body[data-theme="adventure"] #districtMap .map-toolbar,
  html body[data-theme="adventure"] #districtMap #mapSkins .skin-gallery-header {
    background: linear-gradient(180deg, #ffffff40 0 3px, transparent 3px), repeating-linear-gradient(92deg, #0000 0 60px, #6a2a0a1c 60px 63px), linear-gradient(180deg, #e79a4f, #c46a2a 55%, #8a3f14);
    border-bottom: 4px solid #ffc934; box-shadow: 0 3px 0 #4e2108, 0 8px 14px #06375a40; color: #fff4d8;
  }
  html body[data-theme="adventure"] #districtMap .map-toolbar::after { content: none; }
  html body[data-theme="adventure"] #districtMap :is(#mapTitle, #skinsTitle) {
    font-family: var(--map-font); color: #fff3a6; -webkit-text-stroke: 1px #4e2108; paint-order: stroke fill; text-shadow: 0 2px 0 #4e2108;
  }
  html body[data-theme="adventure"] #districtMap :is(.map-eyebrow, #mapDistrictLabel) { color: #fff4d8; text-shadow: 0 1px 0 #4e2108; background: none; }
  html body[data-theme="adventure"] #districtMap #mapDistrictLabel { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
  /* --- Navigation buttons: cream/gold toy buttons --- */
  html body[data-theme="adventure"] #districtMap :is(#mapBack, #mapRetry, #mapGuideDismiss, #mapCurrentNode, #mapSkip, #mapFeedbackBackToGame),
  html body[data-theme="adventure"] #districtMap #mapSkins button.skin-gallery-back,
  html body[data-theme="adventure"] #districtMap .candy-village :is(.village-back) {
    font-family: var(--map-font); font-weight: 700; color: #4e2108; min-height: 44px; text-shadow: none;
    background: linear-gradient(180deg, #ffffffaa 0 3px, transparent 3px), linear-gradient(#fff4d8, #f3dcaa);
    border: 3px solid #ffc934; border-radius: 14px; box-shadow: 0 0 0 2px #4e2108, 0 4px 0 #4e2108;
  }
  html body[data-theme="adventure"] #districtMap #mapSkins button.skin-gallery-back:hover { background: linear-gradient(#fffaf0, #ffe7b8); color: #4e2108; }
  html body[data-theme="adventure"] #districtMap :is(#mapCurrentNode, #mapRetry):disabled { color: #5d4c30; background: linear-gradient(#efe6d2, #d6c8a8); border-color: #b9a77c; box-shadow: 0 0 0 2px #7a6a4a, 0 3px 0 #7a6a4a; }
  html body[data-theme="adventure"] #districtMap :is(#mapSkinsButton, #mapBattlesButton) {
    font-family: var(--map-font); color: #fff; min-height: 44px;
    background: linear-gradient(180deg, #ffffff55 0 3px, transparent 3px), linear-gradient(#0e6f9f, #08405f);
    border: 3px solid #ffc934; border-radius: 16px; box-shadow: 0 0 0 2px #4e2108, 0 4px 0 #4e2108;
  }
  html body[data-theme="adventure"] #districtMap :is(#mapSkinsButton, #mapBattlesButton) :is(.map-skins-button-label, .map-skins-button-hint) { color: #fff; text-shadow: 0 1px 0 #052a40; }
  html body[data-theme="adventure"] #districtMap :is(#mapSkinsButton, #mapBattlesButton) .map-skins-button-arrow { background: #ffc934; color: #4e2108; border: 2px solid #4e2108; }
  html body[data-theme="adventure"] #districtMap #mapGuideHelp { background: #fff4d8; color: #4e2108; border: 3px solid #ffc934; box-shadow: 0 0 0 2px #4e2108, 0 3px 0 #4e2108; min-width: 44px; min-height: 44px; }
  /* --- Alerts / status / guide: cream plaques --- */
  html body[data-theme="adventure"] #districtMap :is(#mapLoadState, .map-guide, #mapSequenceStatus),
  html body[data-theme="adventure"] #districtMap #mapSkins :is(.skin-gallery-intro, .board-skin-status) {
    background: linear-gradient(#fff4d8, #fbe7bd); color: #3a1a06; border: 3px solid #ffc934;
    box-shadow: 0 0 0 2px #8a3f14, 0 4px 0 #8a3f14;
  }
  html body[data-theme="adventure"] #districtMap #mapSkins .board-skin-status { border-radius: 0 0 14px 14px; }
  html body[data-theme="adventure"] #districtMap #mapSkins .map-skins-description { color: #3a1a06; }
  html body[data-theme="adventure"] #districtMap #mapSkins .skin-gallery-scope { background: #fff; border-left-color: #0e5f8c; color: #08405f; }
  html body[data-theme="adventure"] #districtMap .map-guide :is(h3, p) { color: #3a1a06; }
  /* --- Wallet: berry brick readout --- */
  html body[data-theme="adventure"] #districtMap .map-wallet {
    background: linear-gradient(180deg, #ffffff55 0 2px, transparent 2px), linear-gradient(160deg, #d6449a, #a81c6f 55%, #6e0f4a);
    border: 3px solid #ffe1f1; box-shadow: 0 0 0 2px #6e0f4a, 0 3px 0 #6e0f4a; color: #fff;
  }
  html body[data-theme="adventure"] #districtMap .map-wallet .brick-number-surface { background: #fff4d8; color: #6e0f4a; }
  html body[data-theme="adventure"] #districtMap .map-wallet .wallet-unit { color: #fff; text-shadow: 0 1px 0 #4a0830; }
  /* --- Skin cards: cream inset in gold frame; previews untouched --- */
  html body[data-theme="adventure"] #districtMap #mapSkins .board-skin-grid button.board-skin-card {
    background: linear-gradient(#fff4d8, #f8e2b3); color: #3a1a06;
    border: 3px solid #ffc934; border-radius: 18px; box-shadow: 0 0 0 2px #8a3f14, 0 5px 0 #8a3f14;
  }
  html body[data-theme="adventure"] #districtMap #mapSkins .board-skin-grid button.board-skin-card:is([aria-pressed="true"], [data-selected="true"]) {
    border-color: #2fc4ef; box-shadow: 0 0 0 3px #0e5f8c, 0 5px 0 #0e5f8c, 0 0 0 7px #fff4d8;
  }
  html body[data-theme="adventure"] #districtMap #mapSkins .board-skin-grid button.board-skin-card:is(:disabled, [data-locked="true"]) {
    border-style: dashed; border-color: #8a7a6a; background: #f1ebe0; box-shadow: 0 0 0 2px #6a5a4a;
  }
  html body[data-theme="adventure"] #districtMap #mapSkins .skin-card-preview { filter: none; opacity: 1; border-color: #c46a2a; }
  html body[data-theme="adventure"] #districtMap #mapSkins .skin-card-name { color: #4e2108; font-family: var(--map-font); }
  html body[data-theme="adventure"] #districtMap #mapSkins :is(.skin-card-district, .skin-card-unlock) { color: #5a3410; }
  html body[data-theme="adventure"] #districtMap #mapSkins .skin-card-state { background: #fff; color: #4e2108; border-color: #8a3f14; }
  html body[data-theme="adventure"] #districtMap #mapSkins button.board-skin-card:is([aria-pressed="true"], [data-selected="true"]) .skin-card-state { background: #08405f; color: #fff; border-color: #08405f; }
  html body[data-theme="adventure"] #districtMap #mapSkins button.board-skin-card:is(:disabled, [data-locked="true"]) .skin-card-state { background: #4e3a2a; color: #fff4d8; border-color: #4e3a2a; }
  /* Village frame lives in village.css "Sugar diorama" block; no overrides here. */
  /* --- Read-only building preview dialog --- */
  html body[data-theme="adventure"] .map-confirm { background: linear-gradient(#fff4d8, #f8e2b3); color: #3a1a06; border: 5px solid #ffc934; border-radius: 24px; box-shadow: 0 0 0 4px #4e2108, 0 10px 0 #4e2108; }
}
@media (forced-colors: none) and (max-width: 600px) {
  html body[data-theme="adventure"] #districtMap :is(.map-toolbar, .skin-gallery-header) { min-width: 0; }
}
