/* ============================================================
   Pokemon booster sim — feuille de style
   Direction : l'interieur d'un sachet de booster (violet profond,
   mylar mat), le foil reserve au moment de la revelation.
   ============================================================ */

:root {
  --ink: #14101f;
  --ink-raise: #1d1730;
  --ink-soft: #261f3c;
  --line: #372d55;
  --line-soft: #2a2242;
  --text: #efeafa;
  --muted: #9e94be;
  --gold: #f2c14e;
  --gain: #57e0a2;
  --loss: #ff6e8a;
  --holo: linear-gradient(115deg, #56e0ff 0%, #a96bff 32%, #ff6fd8 60%, #ffd36e 88%);

  --radius-s: 6px;
  --radius-m: 12px;
  --radius-l: 20px;

  --shell: min(1180px, calc(100vw - 2.5rem));
  --font-display: "Bricolage Grotesque", "Trebuchet MS", sans-serif;
  --font-ui: "Archivo", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background:
    radial-gradient(1200px 600px at 78% -12%, #2b2150 0%, transparent 60%),
    radial-gradient(900px 500px at 4% 104%, #1c2c4a 0%, transparent 62%),
    var(--ink);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}

h1 { font-size: clamp(1.9rem, 1.2rem + 2.2vw, 3rem); line-height: 1.04; }
h2 { font-size: clamp(1.25rem, 1rem + 1vw, 1.7rem); }

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  color: inherit;
}

:focus-visible {
  outline: 2px solid #8fd4ff;
  outline-offset: 3px;
  border-radius: 4px;
}

/* ------------------------------------------------------------- barre haute */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.7rem max(1.25rem, calc((100vw - var(--shell)) / 2));
  background: rgba(20, 16, 31, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.03em;
  font-size: 1.05rem;
}

.brand .seal {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--holo);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06) inset;
  flex: none;
}

.topbar nav {
  display: flex;
  gap: 0.35rem;
  margin-left: auto;
}

.navlink {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-s);
  text-decoration: none;
  line-height: 1.8;
}

.navlink:hover { color: var(--text); background: var(--ink-soft); }
.navlink[aria-current="page"] { color: var(--text); background: var(--ink-soft); }

.wallet {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-left: 1rem;
  border-left: 1px solid var(--line-soft);
}

.wallet output {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--gold);
  min-width: 5.5ch;
  text-align: right;
}

.wallet output.bump { animation: bump 320ms ease; }

@keyframes bump {
  40% { transform: translateY(-3px) scale(1.06); }
}

.bank-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #2b2342, #1f1932);
  color: var(--gold);
  transition: transform 120ms ease, border-color 120ms ease;
}

.bank-btn:hover { transform: translateY(-1px); border-color: var(--gold); }
.bank-btn svg { width: 21px; height: 21px; }

/* ----------------------------------------------------------------- layout */

main {
  width: var(--shell);
  margin: 0 auto;
  padding: 2.5rem 0 5rem;
}

.lede {
  color: var(--muted);
  max-width: 60ch;
  margin: 0.7rem 0 0;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 3rem 0 1.1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--line-soft);
}

/* -------------------------------------------------------- etagere des sets */

.shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 1.1rem;
  margin-top: 2rem;
}

.set-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: linear-gradient(170deg, #241d3a 0%, #191430 100%);
  overflow: hidden;
  transition: transform 150ms ease, border-color 150ms ease;
}

.set-tile:hover { transform: translateY(-3px); border-color: #5a4a8c; }

.set-tile .plate {
  height: 128px;
  display: grid;
  place-items: center;
  padding: 1.1rem;
  background:
    repeating-linear-gradient(105deg, rgba(255, 255, 255, 0.04) 0 2px, transparent 2px 9px),
    linear-gradient(120deg, #322852, #221c3d);
  border-bottom: 1px solid var(--line-soft);
}

.set-tile .plate img { max-width: 78%; max-height: 92px; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.5)); }

.set-tile .meta { padding: 0.9rem 1.05rem 1.05rem; }
.set-tile .meta h3 { font-size: 1.1rem; }
.set-tile .sub { color: var(--muted); font-size: 0.85rem; margin-top: 0.15rem; }

.tags {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.85rem;
}

.tag {
  font-size: 0.8rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
}

.tag.price { color: var(--gold); border-color: rgba(242, 193, 78, 0.35); }

/* ---------------------------------------------------------- page extension */

.set-header {
  display: flex;
  align-items: center;
  gap: 1.6rem;
  flex-wrap: wrap;
  padding-bottom: 1.4rem;
  border-bottom: 1px solid var(--line-soft);
}

.set-header img.logo { max-height: 108px; max-width: min(340px, 60vw); }
.set-header .facts { color: var(--muted); font-size: 0.92rem; }

.buy-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 1.1rem;
  margin: 1.8rem 0 0;
}

.buy {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  text-align: left;
  padding: 1.1rem;
  border-radius: var(--radius-l);
  border: 1px solid var(--line);
  background: linear-gradient(165deg, #251e3d, #1a1531);
  transition: transform 140ms ease, border-color 140ms ease;
}

.buy:hover:not(:disabled) { transform: translateY(-2px); border-color: #6b57a8; }
.buy:disabled { opacity: 0.45; cursor: not-allowed; }

.buy .label { font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; }
.buy .note { color: var(--muted); font-size: 0.88rem; margin-top: 0.15rem; }
.buy .cost {
  margin-top: 0.6rem;
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--gold);
}

/* packaging dessine en CSS quand aucune photo n'est fournie */
.pack {
  position: relative;
  flex: none;
  width: 86px;
  height: 124px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  padding: 10px;
  overflow: hidden;
  background: var(--holo);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.45);
}

.pack::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.08) 45%, rgba(0, 0, 0, 0.6));
}

.pack::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 12px;
  background: repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.5) 0 4px, transparent 4px 8px);
}

.pack img { position: relative; max-width: 92%; max-height: 74%; }
.pack.box { width: 132px; height: 104px; border-radius: 6px; }
.pack.box::after { inset: auto 0 0; height: 22px; background: rgba(0, 0, 0, 0.35); }
.pack.photo { background: #0d0a16; padding: 0; }
.pack.photo img { max-width: 100%; max-height: 100%; }

/* ------------------------------------------------------- listing de cartes */

.toolbar {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: var(--ink-raise);
}

.seg button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.42rem 0.95rem;
}

.seg button[aria-pressed="true"] { background: var(--ink-soft); color: var(--text); }

/* --------------------------------------------------------------- collection */

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

.col-card {
  position: relative;
  margin: 0;
  cursor: zoom-in;
  border-radius: 10px;
}

.col-card .thumb {
  border-radius: 9px;
  overflow: hidden;
  line-height: 0;
  background: #100d1c;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.col-card:hover .thumb,
.col-card:focus-visible .thumb {
  transform: translateY(-4px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.55);
}

.col-card img { width: 100%; display: block; }
.col-card.locked .thumb img { filter: grayscale(1) brightness(0.4); }
.col-card .cap { font-size: 0.86rem; margin-top: 0.5rem; line-height: 1.4; }
.col-card .cap b { display: block; font-weight: 600; }
.col-card .cap .line { display: flex; justify-content: space-between; gap: 0.6rem; }
.col-card .cap em { font-style: normal; color: var(--gold); font-weight: 700; }
.col-card .cap i { font-style: normal; color: var(--muted); }

/* zoom plein ecran sur une carte */
dialog.zoom {
  border: 0;
  background: transparent;
  padding: 0;
  width: min(760px, calc(100vw - 2rem));
  max-height: 100vh;
  overflow: visible;
}

dialog.zoom::backdrop { background: rgba(8, 6, 14, 0.88); }

.zoom-body { display: grid; justify-items: center; gap: 1rem; cursor: zoom-out; }
.zoom-body img {
  max-height: 74vh;
  max-width: 100%;
  border-radius: 14px;
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.7);
}
.zoom-meta { text-align: center; }
.zoom-meta .cname { font-family: var(--font-display); font-size: 1.45rem; font-weight: 700; }
.zoom-meta .cprice { font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; color: var(--gold); }
.zoom-meta .codds { color: var(--muted); font-size: 0.9rem; }

.picker {
  border: 1px solid var(--line);
  background: var(--ink-raise);
  color: var(--text);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font: inherit;
}

.tag.warn { color: #ffc98a; border-color: rgba(255, 201, 138, 0.35); }
.plate-name, .pack-name { font-family: var(--font-display); font-size: 1rem; text-align: center; position: relative; }
.counter.session { color: var(--gold); }

.count-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(20, 16, 31, 0.9);
  border: 1px solid var(--line);
  color: var(--gold);
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
}

.progress {
  height: 6px;
  border-radius: 999px;
  background: var(--line-soft);
  overflow: hidden;
  margin-top: 0.8rem;
}

.progress i { display: block; height: 100%; background: var(--holo); }

/* ------------------------------------------------------------- overlay open */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  flex-direction: column;
  background: radial-gradient(900px 600px at 50% 40%, #241c40 0%, #0e0b18 72%);
}

.overlay.open { display: flex; }

.overlay-top {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.85rem max(1rem, calc((100vw - var(--shell)) / 2));
  border-bottom: 1px solid var(--line-soft);
  background: rgba(14, 11, 24, 0.6);
}

.overlay-top .pnl {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 800;
}

.pnl.up { color: var(--gain); }
.pnl.down { color: var(--loss); }

.overlay-top .counter { color: var(--muted); font-size: 0.92rem; }

.ghost-btn {
  border: 1px solid var(--line);
  background: var(--ink-raise);
  border-radius: 999px;
  padding: 0.4rem 0.95rem;
  color: var(--text);
}

.ghost-btn:hover { border-color: #6b57a8; }
.ghost-btn[aria-pressed="true"] { background: var(--holo); color: #16121f; border-color: transparent; font-weight: 600; }

.stage {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 1.2rem;
  cursor: pointer;
  min-height: 0;
}

.stage-inner { text-align: center; max-width: 440px; }

.reveal-card {
  position: relative;
  display: inline-block;
  border-radius: 14px;
  overflow: hidden;
  line-height: 0;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.6);
  animation: flip 260ms ease-out;
}

.reveal-card img { max-height: min(56vh, 460px); max-width: 100%; }

.reveal-card.holo::after {
  content: "";
  position: absolute;
  inset: -40%;
  background: var(--holo);
  mix-blend-mode: color-dodge;
  opacity: 0.32;
  animation: sheen 900ms ease-out;
}

@keyframes flip {
  from { transform: rotateY(28deg) scale(0.94); opacity: 0; }
  to { transform: none; opacity: 1; }
}

@keyframes sheen {
  from { transform: translateX(-55%) rotate(8deg); opacity: 0.75; }
  to { transform: translateX(55%) rotate(8deg); opacity: 0.32; }
}

.reveal-meta { margin-top: 1rem; }
.reveal-meta .cname { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; }
.reveal-meta .cprice { font-size: 1.6rem; color: var(--gold); font-family: var(--font-display); font-weight: 800; }
.reveal-meta .codds { color: var(--muted); font-size: 0.92rem; margin-top: 0.2rem; }
.hint { color: var(--muted); font-size: 0.85rem; margin-top: 1.1rem; }

.summary { text-align: center; max-width: 620px; }
.summary .big { font-family: var(--font-display); font-size: clamp(2.2rem, 6vw, 3.6rem); font-weight: 800; }
.summary ul { list-style: none; padding: 0; margin: 1.4rem 0 0; display: grid; gap: 0.4rem; }
.summary li { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--line-soft); padding: 0.35rem 0; }
.summary li span:last-child { color: var(--gold); font-weight: 700; }

/* ---------------------------------------------------------------- modales */

dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: #1c1631;
  color: var(--text);
  padding: 1.6rem;
  width: min(430px, calc(100vw - 2rem));
}

dialog::backdrop { background: rgba(8, 6, 14, 0.7); }
dialog h2 { margin-bottom: 0.3rem; }
dialog p { color: var(--muted); margin: 0.2rem 0 1rem; }

.field {
  display: flex;
  gap: 0.5rem;
  margin: 0.9rem 0;
}

.field input {
  flex: 1;
  background: #120f1f;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 0.65rem 0.85rem;
  font: inherit;
}

.chips { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.chips button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
}

.chips button:hover { color: var(--text); border-color: var(--gold); }

.primary {
  border: 0;
  border-radius: 10px;
  padding: 0.65rem 1.2rem;
  font-weight: 700;
  background: var(--gold);
  color: #241b05;
}

.dialog-actions { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; margin-top: 1.2rem; }

.stat-table { display: grid; gap: 0.1rem; }
.stat-table div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.5rem 0; border-bottom: 1px solid var(--line-soft); }
.stat-table div:last-child { border-bottom: 0; }
.stat-table b { font-weight: 700; }
.stat-table .gain b { color: var(--gain); }
.stat-table .loss b { color: var(--loss); }

.msg { color: var(--loss); min-height: 1.2rem; font-size: 0.88rem; }
.empty { color: var(--muted); padding: 2.5rem 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  background: #2a2143;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.6rem 1.15rem;
  z-index: 120;
}

@media (max-width: 720px) {
  .card-row { grid-template-columns: 40px 1fr auto; row-gap: 0.35rem; }
  .card-row .num { display: none; }
  .odds { grid-column: 2 / -1; justify-content: flex-start; }
  .set-header img.logo { max-height: 76px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
