@import url("https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,100..900;1,100..900&display=swap");

* {
  box-sizing: border-box;
}

:root {
  --bg: #040404;
  --panel: #0e0e0f;
  --panel-soft: #131314;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #f4f4f2;
  --muted: #a4a4a2;
  --gold: #f2cb71;
  --gold-strong: #ffd978;
  --shadow: 0 20px 45px rgba(0, 0, 0, 0.45);
  --fw-thin: 100;
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --fw-extrabold: 800;
  --fw-black: 900;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  font-optical-sizing: auto;
  font-feature-settings: "cv11" 1, "ss01" 1;
  background: radial-gradient(circle at 50% -20%, rgba(255, 212, 126, 0.16), transparent 45%), var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

.bg-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.04), transparent 100px),
    linear-gradient(to top, rgba(255, 255, 255, 0.03), transparent 200px);
}

.app-shell {
  position: relative;
  max-width: 1320px;
  margin: 0 auto;
  padding: 20px 20px 30px;
}

.site-header {
  position: relative;
  margin-bottom: 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: #090909;
}

.site-admin-corner {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 9;
}

.header-banner {
  position: absolute;
  inset: 0;
  background-image: url("/public/chicon-header-banner.webp");
  background-size: cover;
  background-position: center 38%;
  opacity: 0.95;
  pointer-events: none;
}

.header-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.35) 0%, rgba(0, 0, 0, 0.05) 35%, rgba(0, 0, 0, 0.55) 100%);
  z-index: 2;
}

.header-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.48) 0%, rgba(0, 0, 0, 0.15) 45%, transparent 80%);
  z-index: 2;
}

.header-layer {
  position: relative;
  z-index: 4;
}

.header-topbar {
  min-height: 250px;
  padding: 10px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
}

.top-nav-spacer {
  min-height: 1px;
}

.top-nav-right {
  display: flex;
  justify-content: flex-end;
}

.admin-entry {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(14, 14, 14, 0.75);
  color: #cfcfce;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: var(--fw-bold);
  transition: border-color 120ms ease, color 120ms ease;
}

.admin-entry:hover {
  border-color: rgba(242, 203, 113, 0.72);
  color: var(--gold);
}

.logo-link {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  margin-top: -2px;
}

.logo-medallion {
  width: clamp(92px, 8.6vw, 132px);
  height: clamp(92px, 8.6vw, 132px);
  border-radius: 999px;
  border: 3px solid rgba(247, 224, 170, 0.95);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45), inset 0 0 0 2px rgba(35, 35, 35, 0.45);
  background-image: url("/public/chicon-mark-from-card.png");
  background-repeat: no-repeat;
  background-size: 100%;
  background-position: center;
  background-color: transparent;
}

.logo-title {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #f0e0b4;
  letter-spacing: 0.12em;
  font-size: clamp(16px, 1.6vw, 25px);
  font-weight: var(--fw-black);
  text-transform: uppercase;
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.42);
}

.logo-title::before,
.logo-title::after {
  content: "•";
  color: #f0cd80;
  font-size: 0.75em;
}

.baseline {
  margin: 0;
  font-size: 11px;
  color: #d9d4c8;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: var(--fw-bold);
  opacity: 0.86;
}

.header-subbar {
  min-height: 38px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(4, 4, 4, 0.86);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.main-menu {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 16px;
  padding: 0 6px;
}

.menu-link {
  position: relative;
  padding: 9px 2px 10px;
  color: #8d8d8f;
  text-transform: uppercase;
  font-weight: var(--fw-bold);
  font-size: 13px;
  letter-spacing: 0.05em;
  transition: color 120ms ease;
}

.menu-link:hover {
  color: #d4d4d5;
}

.menu-link.active {
  color: var(--gold);
}

.menu-link.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1.5px;
  border-radius: 999px;
  background: var(--gold);
}

.content {
  display: grid;
  gap: 18px;
}

.hero-card,
.panel,
.stat-tile,
.progress-card,
.podium-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #111111 0%, #0c0c0d 100%);
  box-shadow: var(--shadow);
}

.hero-card {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 14px;
  align-items: center;
  padding: 20px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: var(--fw-extrabold);
}

.hero-card h1 {
  margin: 0;
  font-size: clamp(26px, 2.7vw, 38px);
}

.hero-subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.hero-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}

.btn {
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: var(--fw-bold);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 120ms ease;
}

.btn.primary {
  color: #0d0d0c;
  background: linear-gradient(180deg, #ffe7a9 0%, #f2cb71 100%);
  border-color: #f4d690;
}

.btn.primary:hover {
  filter: brightness(1.04);
}

.btn.ghost {
  color: #e8e8e7;
  background: #141415;
}

.btn.ghost:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.status-text {
  min-height: 18px;
  color: var(--muted);
}

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

.stat-tile {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-tile span {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: var(--fw-bold);
}

.stat-tile strong {
  font-size: 24px;
}

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

.panel {
  padding: 16px;
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 21px;
  font-weight: var(--fw-extrabold);
}

.progress-list {
  display: grid;
  gap: 10px;
}

.progress-card {
  padding: 11px;
  background: linear-gradient(180deg, #151515 0%, #111 100%);
}

.progress-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
}

.progress-card small {
  color: var(--muted);
  font-size: 12px;
}

.progress-track {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: #212121;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-track span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #f8dea0, #d29e3f);
}

.collection-toolbar {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.collection-toolbar h2 {
  margin: 0;
}

.search-wrap {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.collection-controls {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  align-items: end;
  gap: 10px;
}

.set-filter-wrap {
  display: grid;
  gap: 6px;
  min-width: 0;
  position: relative;
}

.set-filter-wrap label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: var(--fw-semibold);
}

.set-filter-wrap select {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: #111;
  color: var(--text);
  padding: 12px 42px 12px 12px;
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

.set-filter-wrap::after {
  content: "";
  position: absolute;
  right: 18px;
  top: calc(100% - 22px);
  width: 8px;
  height: 8px;
  border-right: 2px solid #d8d8d8;
  border-bottom: 2px solid #d8d8d8;
  transform: translateY(-50%) rotate(45deg);
  pointer-events: none;
  opacity: 0.9;
}

.search-wrap input {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: #111;
  color: var(--text);
  padding: 12px;
}

.search-wrap input,
.set-filter-wrap select {
  min-height: 44px;
}

.search-wrap input::placeholder {
  color: #868687;
}

.search-wrap span {
  color: var(--muted);
  font-size: 12px;
}

.collection-statbar {
  margin: 0 0 10px;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.compact-stat-chip {
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(180deg, #141415 0%, #101011 100%);
  padding: 7px 9px;
  display: grid;
  gap: 2px;
}

.compact-stat-chip span {
  font-size: 10px;
  color: #a8a8a8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: var(--fw-semibold);
}

.compact-stat-chip strong {
  font-size: 14px;
  color: #f3e6c6;
  font-weight: var(--fw-extrabold);
  line-height: 1.2;
}

.collection-deep-stats {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.rarity-stat-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.rarity-stat-chip {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(20, 20, 21, 0.82);
  padding: 7px 8px;
  display: grid;
  gap: 2px;
}

.rarity-stat-label {
  font-size: 10px;
  text-transform: uppercase;
  color: #c9c9c8;
  letter-spacing: 0.04em;
  font-weight: var(--fw-semibold);
}

.rarity-stat-value {
  font-size: 12px;
  color: #f4e3ba;
  font-weight: var(--fw-bold);
}

.theme-stat-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.theme-stat-title {
  font-size: 10px;
  text-transform: uppercase;
  color: #9c9c9a;
  letter-spacing: 0.05em;
  font-weight: var(--fw-semibold);
}

.theme-stat-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(15, 15, 16, 0.86);
  color: #d8d8d6;
  font-size: 11px;
  font-weight: var(--fw-medium);
  padding: 4px 9px;
}

.cards-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(205px, 1fr));
}

.card-entry {
  border-radius: 13px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: linear-gradient(180deg, #151515 0%, #0e0e0e 100%);
  transition: transform 120ms ease, border-color 120ms ease;
  cursor: pointer;
}

.card-entry:hover {
  transform: translateY(-2px);
  border-color: rgba(242, 203, 113, 0.55);
}

.card-entry.hidden {
  display: none;
}

.card-entry.missing {
  opacity: 0.92;
  cursor: default;
}

.card-entry.missing .cover img {
  filter: blur(22px) saturate(0.25) brightness(0.55);
  transform: scale(1.18);
}

.card-entry.missing .cover::before {
  content: "???";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  font-weight: var(--fw-black);
  color: rgba(255, 244, 216, 0.9);
  text-shadow: 0 6px 16px rgba(0, 0, 0, 0.6);
  letter-spacing: 0.1em;
  z-index: 2;
}

.card-entry.missing .meta {
  opacity: 0.72;
}

.cover {
  position: relative;
  aspect-ratio: 5 / 7;
  background: radial-gradient(circle at 50% 20%, #252525, #121212);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cover img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cover.img-missing::after {
  content: "VISUEL EN ATTENTE";
  position: absolute;
  inset: auto 10px 10px 10px;
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: #d8d8d8;
  font-weight: 700;
}

.badge {
  position: absolute;
  border-radius: 999px;
  background: rgba(8, 8, 8, 0.88);
  border: 1px solid var(--line-strong);
  font-size: 11px;
  font-weight: 700;
}

.badge {
  top: 44px;
  right: 8px;
  padding: 3px 8px;
  border-color: rgba(242, 203, 113, 0.65);
  color: #f2cb71;
  z-index: 3;
}

.meta {
  padding: 10px;
}

.code {
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: 12px;
  font-weight: var(--fw-medium);
  color: #9f9f9f;
  margin-bottom: 4px;
}

.name {
  font-weight: var(--fw-bold);
  min-height: 34px;
  margin-bottom: 6px;
}

.rarity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.rarity-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(17, 17, 18, 0.86);
  color: var(--rarity-color, #fff);
  font-size: 12px;
  font-weight: var(--fw-bold);
  padding: 4px 10px;
  line-height: 1;
}

.owned-count {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  border-radius: 999px;
  border: 1px solid rgba(255, 192, 127, 0.8);
  background: linear-gradient(180deg, rgba(108, 49, 19, 0.95), rgba(73, 30, 12, 0.96));
  color: #ffd7a6;
  font-size: 12px;
  font-weight: var(--fw-extrabold);
  padding: 4px 9px;
  line-height: 1;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.38);
}

.tags {
  font-size: 12px;
  color: #9f9f9f;
  margin-bottom: 0;
}

.card-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.card-modal.hidden {
  display: none;
}

.card-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(3px);
}

.card-modal-dialog {
  position: relative;
  width: min(92vw, 720px);
  max-height: 92vh;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #090909;
  padding: 18px;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.56);
  z-index: 1;
  display: grid;
  gap: 12px;
}

.card-modal-title {
  margin: 0;
  text-align: center;
  font-size: 15px;
  color: #ece9dd;
  font-weight: var(--fw-bold);
}

.card-modal-image {
  display: block;
  width: 100%;
  max-height: calc(92vh - 120px);
  object-fit: contain;
  border-radius: 10px;
  background: #0f0f0f;
}

.card-modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  background: rgba(28, 28, 28, 0.9);
  color: #fff4d8;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.card-modal-close:hover {
  border-color: rgba(242, 203, 113, 0.7);
  color: var(--gold);
}

.podium-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.podium-card {
  padding: 14px;
}

.podium-rank {
  margin: 0;
  font-weight: var(--fw-extrabold);
}

.podium-card h3 {
  margin: 4px 0;
}

.rank-1 {
  border-color: rgba(242, 203, 113, 0.42);
}

.rank-2 {
  border-color: rgba(196, 196, 196, 0.35);
}

.rank-3 {
  border-color: rgba(207, 149, 87, 0.35);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

th {
  color: #d3d3d3;
  font-weight: var(--fw-bold);
}

.wiki-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
  color: #d6d6d6;
}

.muted {
  color: var(--muted);
}

.rank-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 9px;
}

.rank-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #121213;
}

@media (max-width: 1100px) {
  .header-topbar {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 10px;
    padding: 12px 14px;
  }

  .header-subbar {
    justify-content: center;
    padding: 4px 10px 6px;
  }

  .main-menu {
    width: 100%;
    justify-content: center;
  }

  .hero-card {
    grid-template-columns: 1fr;
  }

  .panel-grid,
  .podium-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 720px) {
  .app-shell {
    padding: 10px 10px 20px;
  }

  .logo-title {
    font-size: clamp(15px, 5.2vw, 24px);
    letter-spacing: 0.08em;
    gap: 8px;
  }

  .baseline {
    font-size: 13px;
  }

  .main-menu {
    gap: 10px;
    overflow-x: auto;
    justify-content: flex-start;
    width: 100%;
    padding-bottom: 2px;
  }

  .menu-link {
    font-size: 12px;
    white-space: nowrap;
  }

  .stats-row {
    grid-template-columns: 1fr;
  }

  .collection-controls {
    grid-template-columns: 1fr;
  }

  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

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

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