/* Keep dark guide headers legible after the shared panel heading rules. */
body.experience-v2 .panel .expert-guide-card-header h3 { color: #fff; font-size: 22px; margin: 7px 0 0; }
body.experience-v2 .expert-guide-card-header p, body.experience-v2 .expert-guide-card-header p strong { color: #e2e9f3; }
body.experience-v2 .expert-guide-meta span { color: #edf4ff; border: 0; }
body.experience-v2 .panel, body.experience-v2 .metric, body.experience-v2 .report-card, body.experience-v2 .leaderboard-card,
body.experience-v2 .rating-card, body.experience-v2 .player-ranking-card, body.experience-v2 .expert-guide-card,
body.experience-v2 .admin-advanced-block, body.experience-v2 .admin-user-feedback-summary, body.experience-v2 .admin-feedback-meta span,
body.experience-v2 .expert-formation-badge, body.experience-v2 .expert-star-badge, body.experience-v2 .expert-player-reasons details { border: 0; }

.admin-players-disclosure > summary { cursor: pointer; align-items: center; list-style: none; }
.admin-players-disclosure > summary::-webkit-details-marker { display: none; }
.admin-disclosure-label { color: #2f6956; font-weight: 750; white-space: nowrap; }
.admin-players-disclosure[open] .when-closed, .admin-players-disclosure:not([open]) .when-open { display: none; }
#adminPlayerDetailsToggle { margin: 0 0 14px; }
#adminSimulatorAdvancedSection.is-compact .admin-player-table-wrap table { min-width: 0; width: 100%; table-layout: fixed; }
.admin-players-disclosure.is-compact :is(th, td):nth-child(2),
.admin-players-disclosure.is-compact :is(th, td):nth-child(3),
.admin-players-disclosure.is-compact :is(th, td):nth-child(n+5):not(:last-child) { display: none; }
.admin-players-disclosure.is-compact :is(th, td):first-child { width: 45%; }
.admin-players-disclosure.is-compact :is(th, td):nth-child(4) { width: 32%; }
.admin-players-disclosure.is-compact :is(th, td):last-child { width: 23%; }
.admin-players-disclosure .admin-unified-actions { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.admin-more-actions { max-width: 100%; }
.admin-more-actions summary, .admin-player-inline-details summary { color: #416758; font-size: 12px; cursor: pointer; padding: 8px 0; }
.admin-more-actions .row-action { display: block; margin: 7px 0; }
.admin-player-inline-details { display: none; }
.is-compact .admin-player-inline-details { display: block; }
.admin-player-inline-details p { white-space: normal; overflow-wrap: anywhere; font-size: 12px; line-height: 1.8; }
body.experience-v2 .admin-grant-primary { background: #e5f2ea; color: #175e42; font-weight: 800; }
@media (max-width: 640px) {
  .admin-players-disclosure > summary { align-items: flex-start; flex-direction: column; gap: 8px; }
  .admin-players-disclosure.is-compact :is(th, td) { padding: 12px 6px; white-space: normal; overflow-wrap: anywhere; }
  .admin-players-disclosure.is-compact .admin-user-feedback-summary { display: block; border-radius: 8px; }
  .admin-players-disclosure .row-action { padding: 8px 10px; }
}

/* Full roster: one identity badge per section, compact country groups. */
body.experience-v2 .legend-page { scroll-margin-top: 145px; }
body.experience-v2 .legend-roster-panel { box-shadow: none; }
.legend-roster-panel > .panel-heading { align-items: flex-start; flex-wrap: wrap; gap: 12px; }
#legendRosterSummary { color: #245b43; font-size: 14px; white-space: nowrap; }
.legend-controls { display: grid; grid-template-columns: minmax(180px, 1.5fr) repeat(3, minmax(100px, 1fr)) minmax(220px, 1.5fr); gap: 14px; margin: 24px 0 12px; }
.legend-controls label { display: flex; flex-direction: column; gap: 8px; min-width: 0; color: #59685f; font-size: 13px; }
.legend-controls :is(input, select) { width: 100%; min-width: 0; margin: 0; font-size: 14px; }
.legend-filter-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.legend-collection-toggle { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 14px; color: #245b43; }
.legend-collection-toggle input { width: 18px; height: 18px; padding: 0; margin: 0; accent-color: #245b43; }
body.experience-v2 #legendClearFilters { background: transparent; color: #52695c; padding: 10px 0 10px 16px; font-size: 13px; border: 0; box-shadow: none; }
body.experience-v2 .legend-source-hint { margin: 8px 0 28px; color: #68786e; font-size: 12px; }
.legend-section { margin: 0 0 42px; }
.legend-section-heading { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.legend-section-heading img { width: 54px; height: 60px; object-fit: contain; }
.legend-section-heading h3 { margin: 0; font-size: 23px; }
.legend-section-heading > span { margin-left: auto; color: #607368; font-size: 13px; }
.legend-country-group { margin: 0 0 24px; }
.legend-country-heading { display: flex; align-items: baseline; gap: 12px; padding: 10px 0; }
.legend-country-heading h4 { margin: 0; font-size: 16px; color: #314b3d; }
.legend-country-heading > span { color: #6b786f; font-size: 12px; }
.legend-country-players { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); gap: 8px; list-style: none; margin: 0; padding: 0; align-items: start; }
.legend-player { min-width: 0; border: 0; border-radius: 7px; box-shadow: none; }
.legend-player.is-owned { background: #eaf3eb; }
.legend-player.is-unowned { background: #f5f6f3; }
.legend-player-head { display: flex; align-items: flex-start; gap: 10px; padding: 13px 12px; min-width: 0; list-style: none; }
summary.legend-player-head { cursor: pointer; }
summary.legend-player-head::-webkit-details-marker { display: none; }
.legend-player-head:focus-visible { outline: 2px solid #2c6c4e; outline-offset: 2px; border-radius: 7px; }
.legend-player-copy { flex: 1; min-width: 0; }
.legend-name { display: block; font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
.is-owned .legend-name { color: #174e35; font-weight: 800; }
.is-unowned .legend-name { color: #7a817c; font-weight: 500; }
.legend-position { flex: 0 0 34px; padding: 3px 0; color: #69796e; font-size: 11px; font-weight: 650; }
.legend-player-status { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; margin-top: 5px; color: #708075; font-size: 11px; line-height: 1.5; }
.is-owned .legend-player-status { color: #426e50; }
.legend-collection-tag { display: inline-block; background: #efe3bf; color: #715013; padding: 2px 7px; border-radius: 4px; font-size: 11px; font-weight: 650; line-height: 1.5; }
.legend-collection-tag[data-source-kind="highlight"] { background: #e8e2f1; color: #66508b; }
.legend-expand { margin-left: auto; color: #426e50; line-height: 1; font-size: 20px; transition: transform .15s; }
.legend-player details[open] .legend-expand { transform: rotate(180deg); }
.legend-source-content { padding: 0 14px 16px; }
body.experience-v2 .legend-source-content > p { margin: 0 0 10px; color: #52695c; font-size: 11px; }
.legend-origins { margin: 0; padding: 0; list-style: none; }
.legend-origins li { font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.legend-origins li > span:not(.legend-collection-tag) { display: block; }
.legend-origins li + li { margin-top: 14px; }
.legend-origins small { display: block; color: #6b786f; font-size: 11px; }
.legend-empty { padding: 24px 12px; color: #637468; background: #f8faf6; }
@media (max-width: 1050px) {
  .legend-controls { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .legend-controls .legend-search { grid-column: span 2; }
}
@media (max-width: 600px) {
  body.experience-v2 .legend-page { scroll-margin-top: 210px; }
  .legend-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .legend-controls .legend-sort { grid-column: 1 / -1; }
  .legend-section-heading { flex-wrap: wrap; gap: 10px; }
  .legend-section-heading > span { flex-basis: 100%; margin-left: 0; }
  .legend-country-players { grid-template-columns: 1fr; }
}
/* Identity artwork has its own outline; the generic team shield must not cut it. */
.has-legend-identity .reveal-team-shield { clip-path: none; background: transparent; box-shadow: none; overflow: visible; }
.has-legend-identity .reveal-team-shield img { object-fit: contain; }
/* Fallback before the home gallery initializes, matching both live slides. */
body.experience-v2 .home-hero-art { object-position: 50% 0%; }
body.experience-v2 #adminSimulatorAdvancedSection .admin-grant-primary { background: #e5f2ea; color: #175e42; font-weight: 800; }
body.experience-v2 :is(.panel, .metric, .stat-card, .result-tile, .inventory-summary, .fragment-card, .activity-info-card, .pool-summary-card, .admin-source-badge, .admin-user-feedback-summary) { border: 0; }
@media (max-width: 720px) {
  body.experience-v2 #adminSimulatorAdvancedSection .admin-user-tools { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 420px) {
  body.experience-v2 #adminSimulatorAdvancedSection .admin-user-tools { grid-template-columns: 1fr; }
}

/* Keep placeholders until pixels have loaded, including in hidden-page galleries. */
body.experience-v2 img.managed-portrait:not([data-image-state="ready"]) { visibility: hidden; }
body.experience-v2 img.managed-portrait[data-image-state="ready"] + .portrait-fallback { display: none; }
body.experience-v2 .collectible-art > img.managed-portrait:not([data-image-state="ready"]) + .portrait-fallback { display: block; }
body.experience-v2 .collectible-art > .portrait-fallback { grid-area: 1 / 1; color: #735523; font-size: 36px; font-weight: 700; }
body.experience-v2 .collectible-art > img.managed-portrait { position: absolute; inset: 34px 16px 14px; width: calc(100% - 32px); height: calc(100% - 48px); filter: none; }
body.experience-v2 .collectible-art { min-height: 0; }

/* Use a real image layer: transparent pseudo-elements at negative z-index can vanish in embedded browsers. */
body.experience-v2 :is(.workspace-intro,.collection-heading).media-chapter > .media-chapter-art { position: absolute; z-index: 0; inset: 0 0 0 40%; width: 60%; height: 100%; object-fit: cover; pointer-events: none; }
body.experience-v2 :is(.workspace-intro,.collection-heading).media-chapter::before { z-index: 1; background-image: linear-gradient(90deg,#10272b,#10272b15 75%); pointer-events: none; }
body.experience-v2 :is(.workspace-intro,.collection-heading).media-chapter > :not(.media-chapter-art) { position: relative; z-index: 2; }
body.experience-v2 .workspace-intro.media-chapter #workspaceAction { position: absolute; }

body.experience-v2 #revealModal .reveal-special-status { position: relative; z-index: 4; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; max-width: 100%; color: #edf3ef; font-size: 12px; text-align: center; }
body.experience-v2 #revealModal .reveal-special-status[hidden] { display: none; }
body.experience-v2 #revealModal .reveal-special-status button { padding: 8px 12px; border: 0; border-radius: 16px; background: #edf3ef; color: #123038; cursor: pointer; }

/* Bound every reveal layer to the available screen. No filtered transparent image surfaces on phones. */
body.experience-v2 #revealModal { overflow: hidden; padding: 8px; }
body.experience-v2 #revealModal .reveal-panel { box-sizing: border-box; width: min(1000px,100%); max-width: 100%; min-height: 0; }
body.experience-v2 #revealModal #revealSpecial { perspective: none; transform-style: flat; }
body.experience-v2 #revealModal #revealSpecialArt { background: transparent; }
@media (max-width: 700px) {
  body.experience-v2 :is(.workspace-intro,.collection-heading).media-chapter > .media-chapter-art { inset: 0; width: 100%; }
  body.experience-v2 :is(.workspace-intro,.collection-heading).media-chapter::before { inset: 0; background-image: linear-gradient(90deg,#10272be6,#10272b77); }
  body.experience-v2 #revealModal { padding: 8px; padding-top: max(8px,env(safe-area-inset-top)); padding-bottom: max(8px,env(safe-area-inset-bottom)); }
  body.experience-v2 #revealModal .reveal-panel { height: calc(100vh - 16px); height: calc(100dvh - 16px); max-height: 100%; padding: 42px 10px 16px; perspective: none; transform: none; gap: 10px; }
  body.experience-v2 #revealModal .reveal-backdrop { background: radial-gradient(ellipse at 75% 20%,#af8e293d,transparent 60%),linear-gradient(145deg,#101d2d,#143240); backdrop-filter: none; -webkit-backdrop-filter: none; }
  body.experience-v2 #revealModal .reveal-light { filter: none; }
  body.experience-v2 #revealModal #revealCloseButton { top: 0; right: 0; width: 38px; height: 38px; }
  body.experience-v2 #revealModal .reveal-meta { max-width: 100%; overflow-wrap: anywhere; }
  body.experience-v2 #revealModal.has-special-reveal .reveal-card-sleeve { display: none; }
  body.experience-v2 #revealModal.has-special-reveal #revealCard { left: -16%; width: min(250px,64vw); height: min(360px,49vh); height: min(360px,49dvh); min-height: 220px; transform: scale(.72); transform-origin: center; }
  body.experience-v2 #revealModal.has-special-reveal #revealSpecial { inset: 5% 0 23% 16%; place-items: center; overflow: hidden; }
  body.experience-v2 #revealModal.has-special-reveal #revealSpecialArt { width: 100%; height: 100%; max-width: 100%; max-height: 100%; object-fit: contain; filter: none; transform: none; transition: opacity .4s ease; }
  body.experience-v2 #revealModal.has-special-reveal .reveal-special-veil { display: none; }
  body.experience-v2 #revealModal.has-special-reveal.reveal-modal-stage-flag #revealSpecialArt { opacity: 0; }
  body.experience-v2 #revealModal.has-special-reveal.reveal-modal-stage-position #revealSpecialArt { opacity: .18; }
  body.experience-v2 #revealModal.has-special-reveal.reveal-modal-stage-team #revealSpecialArt { opacity: .5; }
  body.experience-v2 #revealModal.has-special-reveal.reveal-modal-stage-player #revealSpecialArt { opacity: 1; }
}
