:root {
  color-scheme: dark;
  --bg: #090d0b;
  --panel: #111713;
  --panel-2: #16211b;
  --ink: #f4f1ea;
  --muted: #9aa8a2;
  --line: #233129;
  --accent: #35e0a6;
  --paris-red: #9f2637;
  --paris-blue: #2e5f86;
  --paris-gold: #c49a45;
}

* {
  box-sizing: border-box;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 52% 4%, rgba(53, 224, 166, 0.08), transparent 36rem),
    linear-gradient(180deg, #0d1210 0%, var(--bg) 58%, #050706 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
a {
  color: inherit;
}

button {
  border: 0;
  font: inherit;
  cursor: pointer;
}

#person-rarity-info { display:inline-grid; place-items:center; width:19px; height:19px; min-height:0; padding:0; margin-left:4px; border:1px solid #9fcbbb; border-radius:50%; background:#24483a; color:#e2fff2; font:600 12px/1 sans-serif; vertical-align:middle; cursor:pointer; }
#person-rarity-info[hidden] { display:none; }
#person-rarity-explanation { position:fixed; inset:0; margin:auto; width:min(430px,calc(100vw - 40px)); max-height:80vh; overflow:auto; box-sizing:border-box; padding:24px; border:1px solid #84c9aa; border-radius:18px; background:#14231c; color:#e4eee8; box-shadow:0 18px 70px #0009; font:14px/1.6 system-ui,sans-serif; }
#person-rarity-explanation::backdrop { background:#0006; }
#person-rarity-explanation p { margin:14px 0; }
#person-rarity-explanation button { border:1px solid #8ac8aa; border-radius:9px; padding:9px 18px; background:#284c3b; color:#e4ffee; }
button:disabled {
  cursor: progress;
  opacity: 0.55;
}

.app-frame {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 15px;
  border-right: 1px solid rgba(255, 255, 255, 0.03);
  background: #101512;
  backdrop-filter: blur(18px);
}

.brand {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 900;
}

.brand-word {
  font-size: 1.45rem;
  letter-spacing: 0;
}

.brand-word b {
  color: var(--accent);
}

.brand-alert {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: #fff;
  background: #ff3852;
  border-radius: 999px;
  font-size: 0.78rem;
  line-height: 1;
}

.main-nav {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}

.main-nav a,
.account-nav a {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 0 14px;
  color: #a5b2b8;
  border: 1px solid transparent;
  border-radius: 12px;
  text-decoration: none;
  font-size: 1rem;
  font-weight: 800;
}

.main-nav a.active,
.main-nav a:hover,
.account-nav a.active,
.account-nav a:hover {
  color: var(--accent);
  background: #123527;
  border-color: rgba(53, 224, 166, 0.09);
}

.main-nav strong {
  color: var(--accent);
  font-size: 0.78rem;
}

.main-nav strong:empty {
  display: none;
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  color: #f4f7f5;
  font-size: 1.35rem;
  font-style: normal;
  line-height: 1;
}

.app-shell {
  width: min(1180px, calc(100% - 34px));
  margin: 0 auto;
  padding: 28px 0 64px;
}

.app-shell > section[hidden] { display:none !important; }

.pack-screen {
  min-height: 92vh;
  display: grid;
  justify-items: center;
  align-content: start;
  padding: 8px 0 34px;
  text-align: center;
}

.pack-heading h1 {
  margin: 0;
  color: #ffffff;
  font-size: clamp(2.55rem, 6vw, 4.9rem);
  line-height: 0.92;
  letter-spacing: 0;
  text-shadow: 0 2px 0 rgba(46, 95, 134, 0.92);
}

.pack-heading p {
  margin: 10px 0 6px;
  color: var(--muted);
  font-size: clamp(1rem, 1.6vw, 1.18rem);
}

.text-link {
  background: transparent;
  color: var(--accent);
  font-size: 0.92rem;
}

.card-grid {
  width: min(100%, 1040px);
  display: grid;
  grid-template-columns: repeat(5, minmax(126px, 1fr));
  gap: 14px;
  min-height: 318px;
  margin: 34px auto 20px;
  perspective: 1400px;
}

.card-shell {
  min-width: 0;
  aspect-ratio: 2 / 3;
  display: grid;
  container-type: inline-size;
  transform-style: preserve-3d;
}

.card-face {
  position: relative;
  display: block;
  min-width: 0;
  height: 100%;
  padding: 0;
  overflow: hidden;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.card-photo {
  position: absolute;
  z-index: 1;
  top: 5.75%;
  left: 9.55%;
  width: 81.1%;
  height: 47.15%;
  margin: 0;
  overflow: hidden;
  border-radius: 3.2cqw;
}

.card-new-badge {
  position: absolute;
  z-index: 4;
  top: 7%;
  right: 12%;
  padding: 0.3em 0.55em;
  border: 1px solid #fff;
  border-radius: 5px;
  background: #b52b23;
  color: #fff;
  font: 900 3.4cqw/1.2 Arial, sans-serif;
  letter-spacing: 0.05em;
  box-shadow: 0 2px 6px #0006;
  pointer-events: none;
}


.card-photo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  /* Keep transparent logos and diagram labels readable on the dark theme.
     Opaque photographs cover this backing and retain their original colours. */
  background-color: #fff;
}

.card-photo.transport-picto-cover { background: #f5f8f7; }
/* Preserve the complete dancer and the torch on the two selected action photos. */
.card-photo img[src="/assets/jo-action-20260926/6821f6d65432de.jpg"],
.card-photo img[src="/assets/jo-action-20260926/92bece54ab4183.jpg"] {
  object-fit: contain;
  background: #0d1712;
}
.card-photo.transport-picto-cover img { object-fit: contain; padding: 12%; box-sizing: border-box; }

/* Keep the complete GR 75 route visible, without cropping the loop. */
.card-photo img[src$="/gr75-route-map.png"] { object-fit: contain; }

/* PSG badge: display the complete crest, not a cropped circular logo. */
.card-photo img[src$="/paris-identities-20260926/psg-logo.svg"] {
  object-fit: contain;
  padding: 6%;
  box-sizing: border-box;
}

/* Keep the complete Paris Games Week wordmark visible on its white backing. */
.card-photo img[src="/assets/pgw-logo-20260926.png"] {
  object-fit: contain;
  padding: 8%;
  box-sizing: border-box;
}

.card-skin {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.card-arrondissement {
  position: absolute;
  z-index: 3;
  top: 48.65%;
  right: 10.75%;
  display: grid;
  place-items: center;
  width: 15.5%;
  height: 3.75%;
  color: var(--rarity-accent);
  font-size: 3.05cqw;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
}

.card-copy {
  position: absolute;
  z-index: 3;
  top: 55.9%;
  right: 10.5%;
  bottom: 17.5%;
  left: 11.2%;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  text-align: left;
}

.card-name {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: #10131d;
  font-family: "Playfair Display", "Libre Baskerville", Georgia, "Times New Roman", serif;
  font-size: 6.45cqw;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 1.2cqw;
  margin: 1.45cqw 0 0;
  overflow: hidden;
  color: #111;
  font-size: 3.65cqw;
  font-weight: 700;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-meta-label {
  flex: 0 1 auto;
  max-width: 44%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metro-line-badges {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.75cqw;
  min-width: max-content;
}

.metro-line-badge {
  flex: 0 0 auto;
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 5.25cqw;
  height: 5.25cqw;
  overflow: hidden;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: 0 0.35cqw 0.9cqw rgba(0, 0, 0, 0.2);
}

.metro-line-badge img {
  display: block;
  width: 100%;
  height: 100%;
}

.metro-line-badge span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.card-description {
  display: -webkit-box;
  margin: 3.2cqw 0 0;
  overflow: hidden;
  color: #111827;
  font-size: 3.1cqw;
  font-weight: 400;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.is-interactive-card {
  cursor: pointer;
}

.is-interactive-card .card-face {
  transition: transform 170ms ease, filter 170ms ease;
  will-change: transform;
}

.is-interactive-card:hover .card-face,
.is-interactive-card:focus-visible .card-face {
  filter: drop-shadow(0 1.2cqw 1.8cqw rgba(0, 0, 0, 0.18));
  transform: translateY(-1.2cqw) rotate(-0.35deg);
}

.is-interactive-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.card-footer {
  position: absolute;
  z-index: 4;
  right: 9.55%;
  bottom: 8.3%;
  left: 9.55%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3.4%;
  height: 7.8%;
}

.wallace-maps-status {
  position: absolute;
  left: 8%;
  top: 43%;
  z-index: 5;
  padding: 3px 6px;
  border-radius: 5px;
  background: #fff4d5;
  color: #513706;
  font-size: clamp(9px, 0.8vw, 12px);
  font-weight: 700;
  pointer-events: none;
}
.wallace-maps-status.is-direct { background: #d1fae5; color: #064e3b; }

.card-hotspot {
  display: block;
  min-width: 0;
  height: 100%;
  border-radius: 2.4cqw;
}

.card-hotspot:focus-visible {
  outline: 2px solid #111827;
  outline-offset: -3px;
}

.card-hotspot.is-disabled {
  pointer-events: none;
}

/* Inpainted artwork, at its original scale: only the Maps region is replaced.
   Keep the original photo transparency, Wiki button and outer frame intact. */
.card-maps-fill {
  position: absolute;
  z-index: 3;
  inset: 0;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  mask-image: linear-gradient(to right, transparent 49%, #000 51%, #000 92%, transparent 94%),
    linear-gradient(to bottom, transparent 77%, #000 82%, #000 93%, transparent 95%);
  mask-composite: intersect;
  pointer-events: none;
}
.is-personality .card-arrondissement { width: auto; min-width: 15.5%; max-width: 80%; }
/* Reuse the button-free wave artwork on the left for Invaders only. */
.card-invader-wiki-fill { transform:scaleX(-1); }
.card-arrondissement:empty { display: none; }
.card-detail-map-panel[hidden] { display: none; }
.is-personality-detail .card-detail-layout { grid-template-columns: minmax(200px, 340px) minmax(0, 1fr); }
@media (max-width: 560px) { .is-personality-detail .card-detail-layout { grid-template-columns: 1fr; } }

.is-hidden-card {
  opacity: 0.72;
  animation: riseIn 420ms ease both;
}

.pack-reveal-slot {
  cursor: pointer;
  opacity: 0.86;
  transition: filter 160ms ease, opacity 160ms ease, transform 160ms ease;
}

.pack-reveal-slot:hover,
.pack-reveal-slot:focus-visible,
.pack-reveal-slot.is-next-reveal {
  opacity: 1;
  filter: drop-shadow(0 16px 30px rgba(53, 224, 166, 0.22));
  transform: translateY(-4px);
}

.pack-reveal-slot:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 5px;
}

.card-back-face {
  place-items: center;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.card-back-face::before,
.card-back-face::after {
  display: none;
}

.card-back-face img {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.28));
}

.flip-in {
  animation: flipIn 560ms cubic-bezier(.2,.8,.2,1) both;
}

.pack-actions {
  display: grid;
  grid-template-columns: minmax(190px, 260px) minmax(180px, 240px) minmax(132px, 180px);
  gap: 12px;
  margin: 4px 0 22px;
}

.primary-action,
.admin-action,
.ghost-action {
  min-height: 54px;
  font-weight: 950;
  font-size: clamp(0.98rem, 1.4vw, 1.28rem);
}

.primary-action {
  color: var(--accent);
  background: transparent;
  text-shadow: 0 0 18px rgba(0, 195, 137, 0.55);
}

.primary-action:hover {
  color: #28e0aa;
}

.admin-action {
  color: #07100c;
  background: var(--accent);
  box-shadow: 0 10px 26px rgba(53, 224, 166, 0.18);
}

.admin-action:hover {
  background: #69eec2;
}

.ghost-action {
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
}

.pack-counter {
  display: grid;
  gap: 7px;
  min-width: min(100%, 278px);
  padding: 18px 22px;
  background: rgba(18, 24, 20, 0.76);
  border: 1px solid #26342c;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.pack-counter strong {
  color: var(--accent);
  font-size: 1.35rem;
}

.pack-counter strong span:nth-child(2),
.pack-counter strong span:nth-child(3) {
  color: var(--muted);
}

.pack-counter small,
.result-summary,
.section-heading p,
.mini-card span,
.compact-card small,
.progress-tile span,
.progress-tile small {
  color: var(--muted);
}

.result-summary {
  margin: 16px 0 0;
}

.progress-panel,
.collection-panel,
.all-cards-panel,
.stats-panel {
  padding: 28px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.stats-panel {
  padding-bottom: 42px;
}

.stats-heading > div {
  display: grid;
  gap: 5px;
}

.stats-reset {
  min-height: 38px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
}

.stats-reset:hover {
  color: var(--ink);
  border-color: var(--accent);
}

.stats-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 270px));
  gap: 12px;
  margin-bottom: 16px;
}

.stats-filters label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.stats-filters select {
  width: 100%;
  min-height: 44px;
  padding: 0 38px 0 12px;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 0;
  font: inherit;
}

.stats-filters select:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent);
  outline-offset: 2px;
}

.stats-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.stats-kpi {
  min-height: 92px;
  padding: 15px;
  background: rgba(16, 21, 17, 0.82);
  border: 1px solid var(--line);
}

.stats-kpi span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
}

.stats-kpi strong {
  display: block;
  margin-top: 12px;
  color: var(--ink);
  font-size: 1.75rem;
  line-height: 1;
}

.stats-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.chart-panel {
  min-width: 0;
  padding: 16px;
  background: rgba(16, 21, 17, 0.82);
  border: 1px solid var(--line);
}

.category-chart-panel {
  grid-column: 1 / -1;
}

.chart-panel header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 18px;
}

.chart-panel h3 {
  margin: 0;
  font-size: 1rem;
}

.chart-panel header span {
  color: var(--muted);
  font-size: 0.72rem;
}

.rarity-stack {
  display: flex;
  width: 100%;
  height: 22px;
  overflow: hidden;
  background: #202920;
}

.rarity-stack span {
  width: var(--segment);
  min-width: 3px;
  height: 100%;
  background: var(--chart-color);
}

.rarity-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px 16px;
  padding: 0;
  margin: 18px 0 0;
  list-style: none;
}

.rarity-legend li {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  min-width: 0;
  font-size: 0.75rem;
}

.rarity-legend i {
  width: 9px;
  height: 9px;
  background: var(--chart-color);
}

.rarity-legend span {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rarity-legend small {
  color: var(--muted);
  font-weight: 600;
}

.bar-chart {
  display: grid;
  gap: 7px;
}

.bar-row {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) 35px;
  gap: 8px;
  align-items: center;
  min-width: 0;
  font-size: 0.72rem;
}

.category-chart .bar-row {
  grid-template-columns: minmax(120px, 190px) minmax(0, 1fr) 40px;
}

.bar-row > span {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-row > i {
  display: block;
  height: 8px;
  overflow: hidden;
  background: #202920;
}

.bar-row > i > b {
  display: block;
  width: var(--bar);
  height: 100%;
  background: linear-gradient(90deg, var(--paris-blue), var(--accent));
}

.bar-row > strong {
  text-align: right;
}

.chart-empty {
  margin: 22px 0;
  color: var(--muted);
  text-align: center;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  margin-bottom: 14px;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.48rem;
}

.section-heading p {
  margin: 0;
}

.progress-grid,
.arrondissement-grid,
.mini-grid,
.compact-card-list {
  display: grid;
  gap: 10px;
}

.progress-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.arrondissement-grid {
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
}

.mini-grid,
.compact-card-list {
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}

.catalog-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
  padding:18px;
  border:1px solid var(--line);
  border-radius:18px;
  background:linear-gradient(130deg,#16241c,#101912);
}

.catalog-filters label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 400;
}

.catalog-filters label[hidden] { display: none; }

.catalog-filters input,
.catalog-filters select {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 11px;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
}

.catalog-filters select, .catalog-filters input { font-size:13px; font-weight:400; }
.catalog-filters label > span:first-child { padding-left:3px; }
.catalog-filters .catalog-filter-active { border-color:#8fe6c680; background:#20352a; }
#catalog-rarity { border-left:4px solid var(--selected-rarity,var(--line)); }
#all-cards > .section-heading h2 { font-weight:600; }
#catalog-result-count { font-size:13px; font-weight:400; color:var(--muted); }
.catalog-pagination button, .catalog-page-jump button, .catalog-page-jump input { border-radius:9px; font-weight:400; }

.catalog-filters .catalog-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  cursor: pointer;
}

.catalog-filters .catalog-check input {
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
}

.catalog-filters input:focus,
.catalog-filters select:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent);
  outline-offset: 2px;
}

.catalog-filters select option.catalog-parent-option {
  color: var(--accent);
  font-weight: 500;
  background: #10281f;
}

.catalog-filters select option.catalog-child-option {
  color: var(--ink);
  background: var(--panel-2);
}

.catalog-reset {
  height: 42px;
  padding: 0 13px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius:10px;
  font-weight:400;
}

.catalog-reset:hover {
  color: var(--ink);
  border-color: var(--accent);
}

.compact-card-list {
  grid-template-columns: repeat(auto-fill, minmax(154px, 1fr));
  gap: 18px;
  align-items: start;
  perspective: 1400px;
}
@media(min-width:1200px) {
  #all-cards-grid { grid-template-columns:repeat(8,minmax(0,1fr)); gap:12px; }
}

.catalog-real-card {
  transition: filter 160ms ease, transform 160ms ease;
}

.catalog-real-card.is-interactive-card:hover {
  filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.42));
  transform: translateY(-3px);
}

.catalog-real-card.is-owned {
  filter: drop-shadow(0 0 16px color-mix(in srgb, var(--rarity-accent) 26%, transparent));
}

.catalog-card {
  min-width: 0;
  overflow: hidden;
  background: rgba(16, 21, 17, 0.88);
  border: 1px solid var(--line);
  border-radius: 6px;
  transition: border-color 160ms ease, transform 160ms ease;
}

.catalog-card.is-interactive-card:hover {
  border-color: color-mix(in srgb, var(--rarity-accent) 72%, var(--line));
  transform: translateY(-2px);
}

.catalog-card.is-owned {
  border-color: color-mix(in srgb, var(--rarity-accent) 68%, var(--line));
}

.catalog-card figure {
  width: 100%;
  aspect-ratio: 16 / 10;
  margin: 0;
  overflow: hidden;
  background: #1a211c;
}

.catalog-card figure img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  background-color: #fff;
}

.catalog-card-copy {
  display: grid;
  align-content: start;
  min-height: 174px;
  padding: 11px;
  text-align: left;
}

.catalog-card-labels {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.catalog-card-labels span {
  color: var(--rarity-accent);
  font-size: 0.7rem;
  font-weight: 900;
}

.catalog-card-labels small,
.catalog-card-copy p {
  color: var(--muted);
  font-size: 0.7rem;
}

.catalog-card-copy .catalog-card-description {
  display: -webkit-box;
  margin-top: 8px;
  overflow: hidden;
  color: color-mix(in srgb, var(--muted) 82%, var(--ink));
  line-height: 1.35;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.catalog-card-copy h3 {
  display: -webkit-box;
  margin: 9px 0 5px;
  overflow: hidden;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  line-height: 1.08;
  letter-spacing: 0;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.catalog-card-copy p {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catalog-card-links {
  display: flex;
  gap: 12px;
  margin-top: auto;
  padding-top: 12px;
}

.catalog-card-links a {
  color: var(--ink);
  font-size: 0.7rem;
  font-weight: 850;
  text-decoration-color: color-mix(in srgb, var(--rarity-accent) 72%, transparent);
  text-underline-offset: 3px;
  text-transform: uppercase;
}

.catalog-pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  align-items: center;
  margin-top: 18px;
}

.catalog-page-jump {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.catalog-pagination-top { margin-bottom: 18px; }

.catalog-page-jump input {
  width: 76px;
  min-height: 42px;
  padding: 6px 8px;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.catalog-pagination button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-size: 1.1rem;
}

.catalog-pagination button:hover:not(:disabled) {
  color: var(--accent);
  border-color: var(--accent);
}

.catalog-pagination button:disabled {
  cursor: default;
  opacity: 0.35;
}

.catalog-pagination span {
  min-width: 100px;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

body.modal-open {
  overflow: hidden;
}

.card-detail-dialog {
  width: min(calc(100% - 32px), 1440px);
  max-width: none;
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  margin: auto;
  padding: 0;
  overflow: auto;
  color: var(--ink);
  background: #101511;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.62);
}

.card-detail-dialog::backdrop {
  background: rgba(3, 6, 4, 0.82);
  backdrop-filter: blur(7px);
}

.card-detail-remove { margin-top: 18px; background: #602c2c; color: #fff; border: 1px solid #b66a6a; }

.card-detail-layout {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(240px, 310px) minmax(260px, 1fr);
  gap: 28px;
  align-items: center;
  padding: 24px;
}

.card-detail-navigation {
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 7;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding: 12px 60px 12px 16px;
  background: #101511;
  border-bottom: 1px solid var(--line);
}

.card-detail-navigation > span { color: var(--muted); font-size: 0.85rem; }
.card-detail-navigation button { min-height: 44px; padding: 8px 14px; cursor: pointer; }
.card-detail-navigation button:disabled { opacity: 0.4; cursor: default; }
.card-detail-navigation button:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.card-detail-preview {
  width: min(100%, 340px);
  margin: 0 auto;
}

.card-detail-map-panel { min-width: 0; align-self: stretch; display: flex; flex-direction: column; gap: 12px; }
.card-detail-map-panel h3 { margin: 0; font-size: 1rem; }
.card-detail-map-panel p { margin: 0; color: var(--muted); font-size: .8rem; }
.card-detail-map-panel iframe { width: 100%; height: 420px; flex: none; border: 1px solid var(--line); border-radius: 8px; background: #e8e8e8; }
.card-detail-map-panel a { color: var(--ink); overflow-wrap: anywhere; }
.card-detail-map-panel [hidden] { display: none; }
.maps-check-badge { align-self: flex-start; padding: 5px 9px; border-radius: 5px; font-size: .85rem; }
.maps-check-badge.is-ok { background: #a6efd0; color: #123a2a; }
.maps-check-badge.is-check { background: #ffe0a6; color: #523300; }
.maps-check-badge.is-missing { background: #d9dce0; color: #30353b; }
.maps-check-badge.is-wiki { background: #b9dcff; color: #173b60; }
.card-detail-map-editor { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.card-detail-map-editor label { font-size: .85rem; }
.card-detail-map-editor input { min-width: 0; width: 100%; padding: 10px; color: var(--ink); background: #101511; border: 1px solid var(--line); border-radius: 4px; }
.card-detail-map-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.card-detail-map-actions button { min-height: 40px; padding: 8px 10px; cursor: pointer; }
@media (min-width: 561px) and (max-width: 1100px) {
  .card-detail-layout { grid-template-columns: minmax(240px, 1fr) minmax(240px, 1fr); }
  .card-detail-copy { grid-column: 1 / -1; }
}

.card-detail-copy {
  min-width: 0;
  padding: 12px 34px 12px 0;
  text-align: left;
}

.card-detail-close {
  position: absolute;
  z-index: 8;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 50%;
  font-size: 1.5rem;
  line-height: 1;
}

.card-detail-close:hover,
.card-detail-close:focus-visible {
  color: var(--ink);
  border-color: var(--line);
  outline: none;
}

.card-detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

#card-detail-sell { margin-left:auto; padding:8px 12px; border:1px solid #bba777; border-radius:8px; background:#ead6ad; color:#000; font:inherit; font-size:12px; cursor:pointer; }
#card-detail-sell[hidden] { display:none; }
.card-detail-badges strong,
.card-detail-badges span {
  padding: 6px 9px;
  color: #07100c;
  background: var(--card-base);
  border: 1px solid color-mix(in srgb, var(--rarity-accent) 55%, transparent);
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 900;
}

.card-detail-copy h2 {
  margin: 16px 0 5px;
  font-family: "Playfair Display", "Libre Baskerville", Georgia, "Times New Roman", serif;
  font-size: clamp(1.65rem, 3vw, 2.45rem);
  line-height: 1.02;
  letter-spacing: 0;
}

#card-detail-prestige-conditions {
  align-self: flex-start;
  margin: 0 0 14px;
  padding: 10px 16px;
  border: 1px solid #c6ad77;
  border-radius: 10px;
  background: #ead6ad;
  color: #49341b;
  font: inherit;
  cursor: pointer;
}
#card-detail-prestige-conditions[hidden] { display: none; }
.card-detail-category {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0;
  color: var(--rarity-accent);
  font-size: 0.9rem;
  font-weight: 800;
}

.card-detail-category .metro-line-badges {
  gap: 5px;
}

.card-detail-category .metro-line-badge {
  width: 26px;
  height: 26px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.24);
}

.card-detail-description {
  max-height: 340px;
  white-space: pre-line;
  margin: 22px 0;
  overflow: auto;
  color: #d5ddd7;
  font-size: 0.95rem;
  line-height: 1.62;
}

.card-detail-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.card-detail-summary-row .card-detail-facts {
  flex: 0 1 320px;
  grid-template-columns: minmax(0, 1fr);
  margin: 0;
}

.card-detail-summary-row .card-detail-facts:has(#card-detail-views-row[hidden]) { display: none; }
.card-detail-summary-row .card-detail-links { margin-left: auto; }

.card-detail-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 20px;
}

.card-detail-facts div {
  min-width: 0;
  padding: 11px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.card-detail-facts dt {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.card-detail-facts dd {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 0.84rem;
}

.card-detail-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.card-detail-links a {
  padding: 10px 13px;
  color: #07100c;
  background: var(--card-base);
  border: 1px solid color-mix(in srgb, var(--rarity-accent) 58%, transparent);
  border-radius: 5px;
  font-size: 0.78rem;
  font-weight: 900;
  text-decoration: none;
}

.card-detail-credit {
  display: block;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.card-detail-credit a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.image-attribution-note { display: block; margin-top: 5px; }
.card-credits-disclosure {
  margin-top: 12px;
  border-top: 1px solid #355044;
  color: #b7c9bd;
}
.card-credits-disclosure > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 0 4px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
}
.card-credits-disclosure > summary::-webkit-details-marker { display: none; }
.card-credits-disclosure > summary span { font-size: 1.1rem; }
.card-credits-disclosure[open] > summary span { transform: rotate(180deg); }
.card-credits-disclosure > summary:hover { color: #f0d99a; }
.card-credits-disclosure > summary:focus-visible { outline: 2px solid #f0d99a; outline-offset: 2px; border-radius: 6px; }
.card-credits-content { padding: 0 4px 12px; }
.card-credits-content .card-detail-credit { margin-top: 0; color: #b7c9bd; }
.card-credits-content .card-detail-credit + .card-detail-credit { margin-top: 10px; }
.card-credits-content [hidden] { display: none; }

.catalog-empty {
  grid-column: 1 / -1;
  padding: 34px 0;
  color: var(--muted);
  text-align: center;
}

.progress-tile,
.mini-card,
.compact-card {
  min-height: 82px;
  padding: 12px;
  background: rgba(16, 21, 17, 0.82);
  border: 1px solid var(--line);
}

.progress-tile {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.progress-tile i {
  grid-column: 1 / -1;
  display: block;
  height: 4px;
  background: #202920;
}

.progress-tile i::before {
  content: "";
  display: block;
  width: var(--progress);
  height: 100%;
  background: var(--accent);
}

.progress-tile strong,
.mini-card strong,
.compact-card strong {
  display: block;
  line-height: 1.16;
}

.progress-tile span,
.mini-card span,
.compact-card small,
.compact-card span {
  display: block;
  margin-top: 7px;
  font-size: 0.78rem;
}

.progress-tile.is-compact {
  min-height: 70px;
}

.compact-card span {
  color: var(--rarity);
  font-weight: 900;
  text-transform: uppercase;
}

.compact-card.is-owned {
  border-color: color-mix(in srgb, var(--rarity) 70%, var(--line));
}

.rarity-COMMON {
  --rarity: #0d745a;
  --rarity-accent: #0d745a;
  --card-base: #8fe6c1;
}

.rarity-UNCOMMON {
  --rarity: #125d91;
  --rarity-accent: #125d91;
  --card-base: #8ecff4;
}

.rarity-RARE {
  --rarity: #573696;
  --rarity-accent: #573696;
  --card-base: #b49aef;
}

.rarity-SUPER_RARE {
  --rarity: #942044;
   --rarity-accent: #942044;
  --card-base: #f08faa;
}

.rarity-ULTRA_RARE {
  --rarity: #964000;
  --rarity-accent: #964000;
  --card-base: #f39a37;
}

.rarity-LEGENDARY {
  --rarity: #755000;
  --rarity-accent: #755000;
  --card-base: #dfaf22;
}

.rarity-ULTRA_LEGENDARY {
  --rarity: #6c4819;
  --rarity-accent: #f6d99f;
  --card-base: #e9d3a3;
}

.card-shell.rarity-ULTRA_LEGENDARY {
  filter: drop-shadow(0 0 3px #fff9) drop-shadow(0 0 11px #c6e8ff70);
}

/* Match the visible outer frame of the other skins, which include margins. */
.card-shell.rarity-ULTRA_LEGENDARY .card-face {
  width: 92%;
  height: 94%;
  left: 4%;
  top: 2.2%;
  /* Trim the opaque PNG margin to the painted frame, matching other skins. */
  clip-path: inset(1.1% 1.4% round 4cqw);
}

.rarity-ULTRA_LEGENDARY .card-skin { object-fit: fill; }

/* Pearl-white edge follows the painted frame, without changing card size. */
.card-shell.rarity-ULTRA_LEGENDARY .card-face::before {
  content: '';
  position: absolute;
  inset: 1.1% 1.4%;
  z-index: 5;
  border: clamp(1px, .65cqw, 2px) solid #fff8e8;
  border-radius: 3.2cqw;
  box-shadow: inset 0 0 3px #e2f4ffcc, 0 0 5px #ffffffaa;
  pointer-events: none;
}

.rarity-ULTRA_LEGENDARY .card-photo {
  z-index: 3;
  top: 5.9%;
  height: 40.5%;
  border-radius: 1.5cqw;
  box-shadow: 0 0 0 1px #e2c6958c;
}

.card-prestige-badge {
  position: absolute;
  z-index: 4;
  top: 7.4%;
  left: 11%;
  padding: .65em .9em;
  border: 1px solid #fff0bc;
  border-radius: .6em;
  background: linear-gradient(130deg, #fff4d3, #d6ad68 45%, #f1e7c8 65%, #a8c7e0);
  color: #241a12;
  font: 900 3.4cqw/1 Arial, sans-serif;
  letter-spacing: .16em;
  box-shadow: 0 2px 8px #0008;
  pointer-events: none;
}

.rarity-ULTRA_LEGENDARY .card-arrondissement {
  z-index: 4;
  top: 42%;
  background: #10151eee;
  border: 1px solid #e8cd9b;
  border-radius: 1cqw;
}

.rarity-ULTRA_LEGENDARY .card-copy { top: 53%; right: 12%; left: 12%; bottom: 21%; }
.rarity-ULTRA_LEGENDARY .card-name { color: #252b35; text-shadow: 0 1px 0 #fff9; }
.rarity-ULTRA_LEGENDARY .card-meta { color: #66501e; }
.rarity-ULTRA_LEGENDARY .card-description { color: #343a42; }

.prestige-footer { bottom: 8%; height: 7.5%; left: 11%; right: 11%; gap: 0; }
.prestige-footer .card-hotspot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.7cqw;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #614817;
  text-shadow: 0 1px 0 #fff9;
  font: 800 4cqw/1 Arial, sans-serif;
  text-decoration: none;
}
.prestige-footer .card-hotspot:first-child::after { content: 'WIKI'; }
.prestige-footer .card-hotspot:last-child::after { content: 'MAPS'; }
.prestige-footer .card-hotspot + .card-hotspot { border-left: 1px solid #d2b07766; }
.prestige-footer .card-hotspot:hover { color: #30200a; background: #c8a65b18; }
.prestige-footer .prestige-link-icon { width: 4.8cqw; height: 4.8cqw; fill: none; stroke: currentColor; stroke-width: 1.7; }
.prestige-footer .card-hotspot.is-disabled { visibility: hidden; }
.prestige-wiki-only .card-hotspot:first-child { grid-column: 1 / -1; }
.prestige-wiki-only .card-hotspot:last-child { display: none; }
.prestige-footer .card-hotspot:focus-visible { outline: 2px solid #614817; outline-offset: 3px; }

/* A brighter pearl/gold foil reflection, behind photo/text and non-interactive. */
.card-shell.rarity-ULTRA_LEGENDARY .card-face::after {
  content: '';
  position: absolute;
  inset: 1%;
  z-index: 2;
  border-radius: 3%;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 33%, #b58a3828 40%, #fff1c86b 45%, #fffffff0 49%, #e3f3ffa6 52%, #c3964938 57%, transparent 63%);
  background-size: 320% 100%;
  background-position: 150% 0;
  animation: prestigeShimmer 5s ease-in-out infinite;
}

@keyframes prestigeShimmer {
  0%, 25% { background-position: 150% 0; opacity: 0; }
  35% { opacity: 1; }
  65% { opacity: 1; }
  78%, 100% { background-position: -60% 0; opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .card-shell.rarity-ULTRA_LEGENDARY .card-face::after { animation: none; opacity: 0; }
}

@keyframes flipIn {
  from {
    opacity: 0;
    transform: rotateY(-86deg) scale(0.92);
  }
  to {
    opacity: 1;
    transform: rotateY(0deg) scale(1);
  }
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  to {
    opacity: 0.72;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 980px) {
  .app-frame {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .main-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: min(100%, 680px);
  }

  .stats-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .catalog-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .compact-card-list { grid-template-columns: repeat(auto-fill, minmax(142px, 1fr)); }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 20px, 1120px);
    padding-top: 18px;
  }

  .main-nav,
  .pack-actions,
  .card-grid {
    grid-template-columns: 1fr;
  }

  .stats-heading,
  .chart-panel header {
    align-items: flex-start;
    flex-direction: column;
  }

  .stats-filters,
  .stats-kpis,
  .stats-layout,
  .catalog-filters {
    grid-template-columns: 1fr;
  }

  .category-chart-panel { grid-column: auto; }
  .rarity-legend { grid-template-columns: 1fr; }
  .category-chart .bar-row { grid-template-columns: 105px minmax(0, 1fr) 34px; }

  .card-grid { width: min(100%, 370px); }

  .card-detail-dialog {
    width: min(calc(100% - 18px), 520px);
    max-height: calc(100vh - 18px);
    max-height: calc(100dvh - 18px);
  }

  .card-detail-layout {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 46px 16px 20px;
  }

  .card-detail-preview { width: min(100%, 270px); }
  .card-detail-copy { padding: 0; }
  .card-detail-description { max-height: none; }
  .card-detail-facts { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .is-interactive-card .card-face {
    transition: none;
    will-change: auto;
  }

  .pack-reveal-slot {
    transition: none;
  }

  .is-interactive-card:hover .card-face,
  .is-interactive-card:focus-visible .card-face,
  .pack-reveal-slot:hover,
  .pack-reveal-slot:focus-visible {
    filter: none;
    transform: none;
  }
}
/* Keep server feedback out of the layout until there is something to report. */
[data-service-status]:empty,[data-reward-status]:empty { display:none; }
[data-refresh][hidden],[data-load-messages][hidden],[data-exchange-retry][hidden],[data-market-retry][hidden] { display:none!important; }
