/* Shared look for the collection pages (Pokémon, One Piece, Naruto) */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  --a: #ffcb05; --b: #0f2a6b;
  min-height: 100vh; color: #fff; font-family: Outfit, system-ui, sans-serif; background: #07070c;
}
/* Dimmed universe scenery behind everything */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1;
  background: linear-gradient(#07070cdd, #07070cf5), var(--bg-img) center / cover;
}

.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding: 16px clamp(16px, 4vw, 48px); background: #07070cd0; backdrop-filter: blur(10px);
  border-bottom: 1px solid #ffffff14;
}
.back { color: #fff9; text-decoration: none; font-weight: 600; }
.back:hover { color: var(--a); }
h1 { font-family: Anton, sans-serif; text-transform: uppercase; font-size: clamp(1.8rem, 4vw, 2.6rem); text-shadow: 3px 3px 0 var(--b), 0 0 30px var(--a); }
.search-btn { margin-left: auto; background: #ffffff14; color: #fff; border: 1px solid #ffffff26; }
.search-btn:hover { border-color: var(--a); color: var(--a); }
.stats { margin-left: 8px; display: flex; gap: 28px; }
.stats div { text-align: right; }
.stats span { display: block; font-family: Anton, sans-serif; font-size: 1.6rem; color: var(--a); }
.stats small { color: #fff9; font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; }

main { max-width: 1280px; margin: 0 auto; padding: 24px clamp(16px, 4vw, 48px) 64px; }
section + section { margin-top: 40px; }
h2 { font-family: Anton, sans-serif; text-transform: uppercase; font-size: 1.5rem; letter-spacing: .03em; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }

button {
  padding: 12px 20px; border-radius: 12px; border: 0; cursor: pointer; font: inherit; font-weight: 700;
  background: var(--a); color: #111;
}
button.ghost { background: transparent; color: var(--a); border: 1px solid var(--a); }
button:disabled { opacity: .5; cursor: default; }
.status { color: #fff9; margin: 10px 0; min-height: 1.2em; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px; margin-top: 14px; }


/* Search dialog, opened from the header on every screen */
dialog {
  width: min(1100px, calc(100% - 32px)); max-height: calc(100dvh - 48px); margin: 24px auto; padding: 20px;
  border: 1px solid #ffffff22; border-radius: 18px; background: #0d0d16f2; color: #fff; overflow-y: auto;
}
dialog::backdrop { background: #000a; backdrop-filter: blur(4px); }
#search-dialog form { display: flex; gap: 8px; position: sticky; top: -20px; padding: 4px 0 8px; background: #0d0d16; z-index: 1; }
dialog input[type=search] {
  flex: 1; min-width: 0; padding: 14px 16px; border-radius: 12px; border: 1px solid #ffffff22;
  background: #ffffff10; color: #fff; font: inherit; font-size: 1rem;
}
dialog input[type=search]:focus { outline: 2px solid var(--a); border-color: transparent; }
.tile-set { color: #fffb; font-size: .78rem; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-set:hover { color: var(--a); }

/* Card window */
.card-dialog { width: min(980px, calc(100% - 32px)); position: fixed; }
.card-dialog .close { position: absolute; top: 12px; right: 12px; z-index: 2; padding: 6px 12px; }
.card-layout { display: grid; grid-template-columns: minmax(220px, 360px) 1fr; gap: 24px; align-items: start; }
.card-visual { position: sticky; top: 0; }
.card-visual img, .card-visual .noimg { width: 100%; aspect-ratio: 245 / 342; object-fit: contain; border-radius: 14px; }
.card-visual img { filter: drop-shadow(0 12px 30px color-mix(in srgb, var(--a) 35%, transparent)); }
.card-body h2 { font-family: Anton, sans-serif; text-transform: uppercase; font-size: 2rem; padding-right: 48px; }
.card-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.cm-link { padding: 8px 14px; border-radius: 999px; background: #1a5fa8; color: #fff; text-decoration: none; font-weight: 700; font-size: .85rem; }
.cm-link:hover { background: #2273c9; }
.cm-link.ghost-link { background: transparent; border: 1px solid #ffffff33; color: #fffc; font-weight: 600; }
.cm-link.ghost-link:hover { border-color: var(--a); color: var(--a); }
.card-mine { margin: 12px 0 18px; padding: 14px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--a) 45%, transparent); background: color-mix(in srgb, var(--a) 7%, transparent); }
.card-mine h3 { font-size: 1rem; margin-bottom: 8px; }
.card-mine h3 small { color: var(--a); font-weight: 600; margin-left: 6px; }
.copy { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid #ffffff12; font-size: .9rem; }
.copy-price { font-family: Anton, sans-serif; color: var(--a); }
.add-copy { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-top: 12px; }
.add-copy label { display: flex; flex-direction: column; gap: 4px; font-size: .75rem; color: #fffb; }
.add-copy select { padding: 9px 10px; border-radius: 10px; border: 1px solid #ffffff26; background: #16161f; color: #fff; font: inherit; font-size: .9rem; }
.add-copy button { padding: 10px 18px; }
.note { color: #fff8; font-size: .75rem; margin-top: 8px; }
.card-source { margin-bottom: 16px; padding: 14px; border-radius: 14px; background: #ffffff0a; border: 1px solid #ffffff14; font-size: .9rem; }
.card-source:empty { display: none; }
.card-source h3 { font-size: 1rem; margin-bottom: 6px; }
.card-source > p { color: #fffd; line-height: 1.45; }
.print { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid #ffffff12; }
.print span:first-child { display: flex; flex-direction: column; }
.print small { color: #fff9; font-size: .75rem; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 10px 0; }
.fact { display: flex; flex-direction: column; font-size: .8rem; }
.fact span { color: #fff9; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; }
.fact b { display: flex; align-items: center; gap: 4px; font-weight: 600; }
.move { padding: 10px 0; border-top: 1px solid #ffffff14; }
.move h4 { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 1rem; }
.move h4 em { margin-left: auto; font-style: normal; font-family: Anton, sans-serif; font-size: 1.2rem; color: var(--a); }
.move p { color: #fffd; font-size: .9rem; line-height: 1.45; margin-top: 4px; }
.tag { padding: 2px 8px; border-radius: 6px; background: #e8473b; font-size: .7rem; text-transform: uppercase; }
.nrj { display: inline-block; width: 16px; height: 16px; border-radius: 50%; vertical-align: -3px; background: var(--c); box-shadow: inset 0 0 0 2px #0004; }
.flavor { margin-top: 12px; font-style: italic; color: #fffb; }
.illus { margin-top: 8px; color: #fff8; font-size: .8rem; }

/* Extension list, grouped by series */
.serie-block { margin-bottom: 18px; }
.serie-block > summary { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; cursor: pointer; list-style: none; padding: 6px 0; margin-bottom: 10px; border-bottom: 1px solid #ffffff1a; }
.serie-block > summary::-webkit-details-marker { display: none; }
.serie-block > summary::before { content: "▾"; color: var(--a); transition: transform .2s; }
.serie-block:not([open]) > summary::before { transform: rotate(-90deg); }
.serie-block:not([open]) > summary { margin-bottom: 0; }
.serie-block > summary span { color: #fff9; font-size: .85rem; }
.serie-block h3 { font-family: Anton, sans-serif; text-transform: uppercase; font-size: 1.25rem; letter-spacing: .03em; }
.set-row {
  display: flex; align-items: center; gap: 14px; padding: 10px 16px; margin-bottom: 8px; border-radius: 14px;
  background: #ffffff0b; border: 1px solid #ffffff14; color: #fff; text-decoration: none; transition: background .2s, border-color .2s, transform .2s;
}
.set-row:hover, .set-row:focus-visible { background: #ffffff18; border-color: var(--a); transform: translateX(4px); outline: none; }
.set-row.has { border-color: color-mix(in srgb, var(--a) 45%, transparent); }
.set-logo { flex: none; width: 72px; height: 36px; display: grid; place-items: center; border-radius: 8px; background: color-mix(in srgb, var(--a) 18%, transparent); }
.set-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.set-name { flex: 1; min-width: 0; font-weight: 600; }
.bar { display: block; height: 4px; margin-top: 6px; border-radius: 2px; background: #ffffff18; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--a); }
.set-count { flex: none; color: #fff9; font-size: .85rem; font-variant-numeric: tabular-nums; }
.set-count::after { content: "  ›"; color: var(--a); }

/* One extension */
.set-banner { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.set-banner img { height: 64px; max-width: 160px; object-fit: contain; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters button { background: #ffffff10; color: #fff; padding: 8px 16px; border-radius: 999px; }
.filters button[aria-pressed=true] { background: var(--a); color: #111; }

/* Tabs above a list (Extensions / Promos / Decks) */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid #ffffff1f; margin-bottom: 6px; }
.tabs button {
  position: relative; padding: 12px 18px; border-radius: 12px 12px 0 0; background: transparent; color: #fff9;
  font-family: Anton, sans-serif; font-weight: 400; font-size: 1.3rem; text-transform: uppercase; letter-spacing: .03em;
}
.tabs button[data-count]::after { content: attr(data-count); margin-left: 8px; font-family: Outfit, sans-serif; font-size: .75rem; color: #fff8; }
.tabs button:hover { color: #fff; }
.tabs button[aria-selected=true] { color: #fff; background: #ffffff0d; }
.tabs button[aria-selected=true]::before { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 3px; border-radius: 3px; background: var(--a); }

/* Filters inside an extension: text search + chips */
.set-filters { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.set-filters input[type=search], .scan-form input {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid #ffffff22;
  background: #ffffff10; color: #fff; font: inherit; font-size: .95rem;
}
.set-filters input[type=search]:focus, .scan-form input:focus { outline: 2px solid var(--a); border-color: transparent; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips:empty { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  background: #ffffff0d; border: 1px solid #ffffff1f; color: #fffd; font-size: .8rem; font-weight: 600;
}
.chip i { width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 0 1px #ffffff40; }
.chip:hover { border-color: var(--a); }
.chip[aria-pressed=true] { background: color-mix(in srgb, var(--a) 25%, transparent); border-color: var(--a); color: #fff; }
.set-filters .status { margin: 0; min-height: 0; }

.tile { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tile-img { all: unset; position: relative; cursor: pointer; border-radius: 10px; transition: transform .2s; }
.tile-img:hover, .tile-img:focus-visible { transform: translateY(-4px); }
.tile-img:focus-visible { outline: 2px solid var(--a); }
.tile-img img, .noimg { display: block; width: 100%; aspect-ratio: 245 / 342; object-fit: contain; border-radius: 10px; }
.noimg { display: grid; place-content: center; gap: 6px; padding: 8px; text-align: center; font-weight: 600; font-size: .85rem;
  background: linear-gradient(160deg, #ffffff14, #ffffff06); border: 2px dashed #ffffff26; }
.noimg small { color: #fff8; font-weight: 400; font-size: .7rem; }
/* Cards you do not own stay greyed out, like an empty binder slot */
.tile:not(.owned) .tile-img img { filter: grayscale(1) brightness(.55); }
.tile.owned .tile-img img { box-shadow: 0 0 0 2px var(--a), 0 8px 24px -8px var(--a); }
.badge { position: absolute; top: 6px; right: 6px; padding: 2px 8px; border-radius: 999px; background: var(--a); color: #111; font-weight: 700; font-size: .8rem; }
.tile .num { color: #fff9; font-size: .8rem; }

/* One row per variant: name and price on the left, its own quantity on the right */
.variant {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 4px 4px 4px 8px; border-radius: 10px; background: #ffffff08; border: 1px solid transparent;
}
.variant.has { border-color: color-mix(in srgb, var(--a) 55%, transparent); background: color-mix(in srgb, var(--a) 10%, transparent); }
.v-label { display: flex; flex-direction: column; min-width: 0; font-size: .72rem; color: #fffb; line-height: 1.2; }
.v-label b { font-family: Anton, sans-serif; font-weight: 400; font-size: 1rem; color: var(--a); letter-spacing: .02em; }
.v-qty { display: flex; align-items: center; gap: 4px; flex: none; }
.v-qty button { width: 26px; height: 26px; padding: 0; border-radius: 50%; background: #ffffff18; color: #fff; font-size: 1rem; }
.v-qty button:hover:not(:disabled) { background: var(--a); color: #111; }
.v-qty button:disabled { opacity: .3; cursor: default; }
.v-qty output { min-width: 1.6ch; text-align: center; font-weight: 700; font-size: .9rem; }

.empty { color: #fff9; padding: 40px 0; text-align: center; grid-column: 1 / -1; }
.cards-section { grid-column: 1 / -1; margin: 18px 0 0; padding-bottom: 6px; border-bottom: 1px solid #ffffff1a; }

/* Phone */
@media (max-width: 600px) {
  /* Compact header: back · title · search icon on one line, totals on a slim second line */
  .top { position: sticky; gap: 6px 12px; padding: 10px 14px; }
  .top h1 { font-size: 1.6rem; flex: 1; text-align: center; }
  .back { font-size: .9rem; }
  .search-btn { margin-left: 0; padding: 8px 12px; font-size: 1.1rem; }
  .search-btn .btn-label { display: none; }
  .stats { margin-left: 0; width: 100%; justify-content: space-between; gap: 12px; }
  .stats div { display: flex; align-items: baseline; gap: 6px; text-align: left; }
  .stats span { font-size: 1.15rem; }
  .stats small { font-size: .65rem; }

  main { padding-top: 16px; }
  h2 { font-size: 1.25rem; }
  .section-head button { padding: 8px 12px; font-size: .8rem; }
  .set-row { padding: 10px 12px; gap: 10px; }
  .set-logo { width: 56px; }
  .set-banner img { height: 44px; max-width: 110px; }
  .filters { flex-wrap: nowrap; overflow-x: auto; }
  .tabs button { flex: 1; padding: 10px 6px; font-size: 1.05rem; }
  .tabs button[data-count]::after { display: block; margin: 2px 0 0; }
  /* Chips scroll sideways instead of stacking many rows */
  .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
  .chip { flex: none; }
  .filters button { flex: none; }

  /* Two cards per row so price and buttons fit side by side, with finger-sized buttons */
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .variant { padding: 4px 4px 4px 8px; }
  .v-label b { font-size: .95rem; }
  .v-qty button { width: 30px; height: 30px; }

  /* Search and card windows take the whole screen */
  dialog, .card-dialog { width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh; margin: 0; padding: 14px; border-radius: 0; border: 0; }
  .card-dialog .close { position: fixed; top: 10px; right: 10px; background: #0d0d16e6; }
  .card-layout { grid-template-columns: 1fr; gap: 14px; }
  .card-visual { position: static; max-width: 210px; margin: 0 auto; }
  .card-body h2 { font-size: 1.6rem; padding-right: 0; text-align: center; }
  .card-sub, #card-sub { text-align: center; }
  .card-links { justify-content: center; }
  .copy { gap: 8px; font-size: .85rem; }
  .add-copy label { flex: 1 1 100%; }
  .add-copy select { width: 100%; }
  .add-copy button { flex: 1 1 100%; }
}

/* Price history in the card window (One Piece) */
.card-history { --c: #3ddc84; margin-top: 14px; padding: 12px; border-radius: 18px; background: #ffffff08; border: 1px solid #ffffff1a; }
.card-history summary { cursor: pointer; padding: 4px 6px; font-weight: 700; }
.card-history summary:hover { color: var(--a); }
.card-history[open] summary { margin-bottom: 10px; }
.card-history button { background: transparent; color: #fffa; font-weight: 600; }
.hist-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; border-radius: 14px; background: #ffffff08; border: 1px solid #ffffff12; }
.hist-modes button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 9px 12px; border-radius: 10px; border: 1px solid transparent; text-align: left; }
.hist-modes button b { color: #fff; font-size: .95rem; }
.hist-modes button small { color: #fff8; font-size: .75rem; font-weight: 400; }
.hist-modes button[aria-pressed="true"] { background: #ffffff14; border-color: #ffffff26; }
.hist-body { padding: 14px 4px 0; }
.hist-body.down { --c: #ff5a5f; }
.hist-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.hist-pct { font-family: Anton, sans-serif; font-size: 2.1rem; line-height: 1; color: var(--c); }
.hist-head b { display: block; font-size: 1rem; }
.hist-head small { color: #fff9; font-size: .85rem; }
.hist-chart { display: block; width: 100%; height: auto; margin-top: 10px; overflow: visible; }
.hist-chart text { fill: #fffc; font-size: 10px; font-weight: 600; font-family: Outfit, sans-serif; }
.hist-chart .hist-date { fill: #fff8; font-weight: 400; }
.hist-max { stroke: #ffffff40; stroke-dasharray: 2 4; }
.hist-line { fill: none; stroke: var(--c); stroke-width: 2.2; stroke-linecap: round; }
.hist-dot { fill: var(--c); stroke: #111; stroke-width: 2; }
.hist-empty { margin: 4px 0 10px; color: #fff9; font-size: .9rem; }
.hist-months { display: flex; gap: 6px; margin: 10px 0 6px; }
.hist-months button { padding: 7px 14px; border-radius: 999px; font-size: .9rem; }
.hist-months button[aria-pressed="true"] { background: #ffffff1a; color: #fff; }
.hist-info { color: #fff9; font-size: .8rem; line-height: 1.45; margin: 4px 2px 12px; }
.hist-source { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 12px 16px; border-radius: 12px; background: #ffffff08; border-left: 3px solid #3ddc84; }
.hist-source span b { display: block; }
.hist-source small { color: #fff8; font-size: .75rem; }
.hist-source > b { font-family: Anton, sans-serif; font-weight: 400; font-size: 1.3rem; color: #3ddc84; }
