/* Board games à venda — estilos
   Ideia central: cada jogo leva uma etiqueta de preço amarela, como em um jogo de segunda mão. */

@font-face {
  font-family: "Bricolage";
  src: url("/fonts/display.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #edeff2;
  --surface: #ffffff;
  --tint: #e2e6ec;
  --ink: #12151c;
  --muted: #566070;
  --line: #d3d8e0;
  --sticker: #ffd43b;
  --sticker-ink: #12151c;
  --action: #2747f5;
  --action-ink: #ffffff;
  --warn: #b4301f;
  --ok: #1d6b45;
  --radius: 14px;
  --shadow-sticker: 0 1px 0 rgb(0 0 0 / .28), 0 8px 12px -8px rgb(0 0 0 / .45);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1218;
    --surface: #181c25;
    --tint: #232937;
    --ink: #eef0f4;
    --muted: #a0a9ba;
    --line: #2b3240;
    --action: #8ea2ff;
    --action-ink: #0b0f1d;
    --warn: #ff8f80;
    --ok: #6fd39c;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 9rem; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Bricolage", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }

.wrap { width: min(1240px, 100% - 2rem); margin-inline: auto; }
@media (min-width: 720px) { .wrap { width: min(1240px, 100% - 3rem); } }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: .75rem; top: -4rem; background: var(--ink); color: var(--paper); padding: .6rem .9rem; border-radius: 8px; z-index: 100; }
.skip:focus { top: .75rem; }

:focus-visible { outline: 3px solid var(--action); outline-offset: 2px; border-radius: 6px; }

/* ---------- Topo ---------- */
.hero { padding: clamp(1.75rem, 5vw, 3.5rem) 0 clamp(1.25rem, 3vw, 2rem); }
.hero-inner { display: grid; gap: .9rem; justify-items: start; }
.brand {
  display: inline-flex; align-items: center; gap: .6rem;
  font-weight: 700; font-size: .95rem; letter-spacing: .01em;
}
.brand::before {
  content: ""; width: 1.55rem; height: 1.55rem; border-radius: 6px;
  background: var(--ink);
  -webkit-mask: url("/favicon.svg") center / contain no-repeat; mask: url("/favicon.svg") center / contain no-repeat;
}
.hero h1 {
  font-size: clamp(2.3rem, 7.2vw, 5rem);
  line-height: .98;
  letter-spacing: -.035em;
  font-weight: 800;
  max-width: 17ch;
  text-wrap: balance;
}
.lede { font-size: clamp(1.1rem, 2.4vw, 1.4rem); font-weight: 500; max-width: 36ch; text-wrap: balance; }
.terms { color: var(--muted); max-width: 60ch; font-size: .98rem; }

/* ---------- Controles ---------- */
.controls {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-block: 1px solid var(--line);
  padding: .75rem 0 .65rem;
}
.controls-inner { display: grid; gap: .6rem; grid-template-columns: 1fr 1fr; }
.field {
  position: relative; display: flex; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  min-height: 3rem; transition: border-color .15s;
}
.field:focus-within { border-color: var(--action); box-shadow: 0 0 0 3px color-mix(in srgb, var(--action) 25%, transparent); }
.field input, .field select {
  width: 100%; min-height: 3rem; border: 0; background: transparent; outline: 0; padding: 0 .9rem; border-radius: 12px;
}
.field.search { grid-column: 1 / -1; }
.field.search svg { position: absolute; left: .9rem; color: var(--muted); pointer-events: none; }
.field.search input { padding-left: 2.6rem; }
.field input::-webkit-search-cancel-button { cursor: pointer; }
.field.select select { appearance: none; -webkit-appearance: none; padding-right: 2.2rem; text-overflow: ellipsis;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23778' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right .85rem center; }
.field select:focus-visible, .field input:focus-visible { outline: 0; }

/* No celular os filtros rolam junto com a página para não ocupar a tela */
@media (max-width: 819px) { .controls { position: static; } }

@media (min-width: 820px) {
  .controls-inner { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, .8fr); }
  .field.search { grid-column: auto; }
}

.chips-row { display: flex; gap: .5rem; align-items: center; margin-top: .6rem; }
.chips { display: flex; gap: .4rem; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: -2px; flex: 1; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: .42rem .85rem; font-size: .92rem; font-weight: 500; white-space: nowrap; min-height: 2.25rem;
  transition: background-color .15s, border-color .15s;
}
.chip:hover { border-color: var(--muted); }
.chip[aria-checked="true"], .chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip.toggle { flex: none; }

/* ---------- Resultado ---------- */
main { padding-bottom: 6.5rem; outline: 0; }
.result-bar { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: 1.1rem 0 .9rem; }
.count { color: var(--muted); font-weight: 500; }
.link-btn { background: none; border: 0; padding: .25rem 0; color: var(--action); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

.grid { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; } }
@media (min-width: 980px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1240px) { .grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

/* ---------- Cartão ---------- */
.card {
  display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  transition: border-color .15s;
}
.card:hover { border-color: color-mix(in srgb, var(--ink) 45%, var(--line)); }
.card-media {
  position: relative; display: block; width: 100%; aspect-ratio: 1 / 1; padding: 0; border: 0;
  background: var(--tint); overflow: hidden;
}
.card-media img { width: 100%; height: 100%; }
.card-media img.cover { object-fit: contain; padding: 6%; }
.card-media img.photo { object-fit: cover; }
.noimg { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: .9rem; }

.sticker {
  position: absolute; left: .6rem; bottom: .6rem;
  display: inline-flex; align-items: baseline; gap: .12em;
  background: var(--sticker); color: var(--sticker-ink);
  padding: .32rem .6rem .36rem; border-radius: 5px;
  transform: rotate(-4deg);
  box-shadow: var(--shadow-sticker);
  font-weight: 800; font-size: 1.2rem; line-height: 1; letter-spacing: -.02em;
  outline: 1.5px dashed rgb(18 21 28 / .3); outline-offset: -4px;
  font-variant-numeric: tabular-nums;
}
.sticker .cur { font-size: .62em; font-weight: 700; letter-spacing: 0; margin-right: .12em; }
.sticker .cents { font-size: .6em; font-weight: 700; }
.sticker.ask { font-size: 1rem; }

.card-body { display: flex; flex-direction: column; gap: .35rem; padding: .8rem .85rem .85rem; flex: 1; }
.card-title { font-size: 1.05rem; line-height: 1.22; font-weight: 700; letter-spacing: -.01em; }
.card-title button {
  all: unset; cursor: pointer; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.card-title button:focus-visible { outline: 3px solid var(--action); outline-offset: 2px; border-radius: 4px; }
.card-pub { color: var(--muted); font-size: .9rem; }
.tags { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .1rem; }
.tag { font-size: .8rem; font-weight: 600; padding: .12rem .5rem; border-radius: 999px; background: var(--tint); }
.tag.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.tag.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }

.card-pub { margin-bottom: .35rem; }
.add {
  margin-top: auto; min-height: 2.5rem; border-radius: 10px; font-weight: 600; font-size: .92rem;
  background: transparent; border: 1.5px solid var(--ink); color: var(--ink);
  transition: background-color .15s, color .15s;
}
.add:hover { background: var(--tint); }
.add[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.add[aria-pressed="true"]::before { content: "✓ "; }

@media (max-width: 479px) {
  .sticker { font-size: 1.02rem; left: .45rem; bottom: .45rem; }
  .card-body { padding: .65rem .65rem .7rem; }
  .card-title { font-size: .98rem; }
}

/* Carregando */
.skel { border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.skel i { display: block; aspect-ratio: 1; background: var(--tint); }
.skel b { display: block; height: .8rem; margin: .9rem .85rem; border-radius: 4px; background: var(--tint); width: 70%; }
.skel b + b { width: 45%; margin-top: 0; }
@media (prefers-reduced-motion: no-preference) {
  .skel i, .skel b { animation: pulse 1.3s ease-in-out infinite; }
  @keyframes pulse { 50% { opacity: .55; } }
}

.empty { text-align: center; padding: 3rem 1rem; display: grid; gap: .6rem; justify-items: center; }
.empty h2 { font-size: 1.5rem; letter-spacing: -.02em; }
.empty p { color: var(--muted); max-width: 40ch; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; text-decoration: none;
  min-height: 2.9rem; padding: 0 1.25rem; border-radius: 12px; border: 1.5px solid var(--ink);
  background: var(--ink); color: var(--paper); font-weight: 650;
  transition: transform .12s, background-color .15s;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--action); border-color: var(--action); color: var(--action-ink); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--tint); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.foot { border-top: 1px solid var(--line); padding: 1.5rem 0 7rem; color: var(--muted); font-size: .92rem; }
.foot p { max-width: 60ch; }

/* ---------- Barra da lista ---------- */
.listbar {
  position: fixed; z-index: 30; left: 50%; bottom: max(1rem, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 1rem; justify-content: space-between;
  width: min(34rem, 100% - 1.5rem);
  background: var(--ink); color: var(--paper);
  padding: .6rem .6rem .6rem 1.1rem; border-radius: 16px;
  box-shadow: 0 14px 30px -10px rgb(0 0 0 / .5);
}
.listbar[hidden] { display: none; }
.listbar p { font-size: .98rem; line-height: 1.25; }
.listbar strong { display: block; font-size: 1.02rem; }
.listbar span { opacity: .8; font-variant-numeric: tabular-nums; }
.sticker-btn { background: var(--sticker); border-color: var(--sticker); color: var(--sticker-ink); white-space: nowrap; }

/* ---------- Janelas (detalhe e lista) ---------- */
dialog.sheet {
  width: min(1100px, 100vw - 2rem); max-height: calc(100dvh - 2rem); padding: 0; border: 0;
  background: var(--surface); color: var(--ink); border-radius: 20px; overflow: auto; overscroll-behavior: contain;
  box-shadow: 0 30px 80px -20px rgb(0 0 0 / .6);
}
dialog.sheet.narrow { width: min(560px, 100vw - 2rem); }
dialog.sheet::backdrop { background: rgb(8 10 16 / .62); backdrop-filter: blur(2px); }
@media (prefers-reduced-motion: no-preference) {
  dialog.sheet[open] { animation: pop .18s ease-out; }
  dialog.sheet[open]::backdrop { animation: fade .18s ease-out; }
  @keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.985); } }
  @keyframes fade { from { opacity: 0; } }
}
body.lock { overflow: hidden; }

.sheet-close {
  position: sticky; top: .6rem; float: right; margin: .6rem .6rem 0 0; z-index: 5;
  width: 2.6rem; height: 2.6rem; border-radius: 50%; border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent); display: grid; place-items: center;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.sheet-close:hover { background: var(--tint); }

.detail { display: grid; gap: 1.25rem; padding: 1rem 1rem 1.5rem; clear: both; }
@media (min-width: 860px) { .detail { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 2rem; padding: 1.5rem 1.75rem 1.75rem; margin-top: -2.2rem; } }

.gallery { min-width: 0; }
.stage {
  position: relative; background: var(--tint); border-radius: 14px; overflow: hidden;
  aspect-ratio: 4 / 5; max-height: 72dvh; width: 100%; touch-action: pan-y;
}
.stage img { width: 100%; height: 100%; object-fit: contain; }
.stage img.cover { padding: 8%; }
.nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 2.8rem; height: 2.8rem; border-radius: 50%;
  border: 0; background: rgb(18 21 28 / .72); color: #fff; display: grid; place-items: center;
}
.nav:hover { background: rgb(18 21 28 / .9); }
.nav.prev { left: .6rem; } .nav.next { right: .6rem; }
.counter { position: absolute; right: .7rem; top: .7rem; background: rgb(18 21 28 / .72); color: #fff; font-size: .82rem; font-weight: 600; padding: .2rem .55rem; border-radius: 999px; }
.caption { margin-top: .5rem; color: var(--muted); font-size: .9rem; min-height: 1.4em; }
.thumbs { display: flex; gap: .45rem; overflow-x: auto; padding: 3px; margin: .4rem -3px 0; scrollbar-width: thin; }
.thumbs button { flex: none; width: 4.2rem; aspect-ratio: 1; padding: 0; border: 2px solid transparent; border-radius: 10px; overflow: hidden; background: var(--tint); opacity: .75; }
.thumbs button[aria-current="true"] { border-color: var(--ink); opacity: 1; }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.thumbs img.cover { object-fit: contain; padding: 4px; }

.info { display: grid; gap: 1rem; align-content: start; min-width: 0; }
.info .pub { color: var(--muted); font-weight: 600; }
.info h2 { font-size: clamp(1.7rem, 4.5vw, 2.6rem); line-height: 1.05; letter-spacing: -.03em; font-weight: 800; text-wrap: balance; }
.price-row { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }
.price-row .sticker { position: static; font-size: 1.9rem; transform: rotate(-3deg); }
.price-note { color: var(--muted); font-size: .94rem; max-width: 24ch; line-height: 1.3; }
.notes { background: var(--tint); border-radius: 12px; padding: .7rem .9rem; }
.block h3 { font-size: 1rem; font-weight: 700; margin-bottom: .5rem; }
.exp-list { display: grid; gap: .4rem; }
.exp-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem .8rem; border: 1px solid var(--line); border-radius: 10px; }
.exp-list span { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }
.mech { display: flex; flex-wrap: wrap; gap: .35rem; }
.mech .tag { font-weight: 500; }
.mech .more { border: 1px dashed var(--muted); background: none; cursor: pointer; font-family: inherit; color: var(--ink); }
.links { display: flex; gap: 1.1rem; flex-wrap: wrap; }
.links a { color: var(--action); font-weight: 600; text-underline-offset: 3px; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; position: sticky; bottom: 0; background: var(--surface); padding: .75rem 0 .1rem; margin-top: .25rem; border-top: 1px solid var(--line); }
.actions .btn { flex: 1 1 11rem; }

/* Lista */
.list-wrap { padding: 1.25rem 1.25rem 1.4rem; clear: both; display: grid; gap: 1rem; }
.list-wrap h2 { font-size: 1.6rem; letter-spacing: -.025em; font-weight: 800; padding-right: 3rem; }
.items { display: grid; gap: .5rem; }
.item { display: grid; grid-template-columns: 3.6rem 1fr auto; gap: .8rem; align-items: center; padding: .5rem; border: 1px solid var(--line); border-radius: 12px; }
.item img { width: 3.6rem; height: 3.6rem; object-fit: cover; border-radius: 8px; background: var(--tint); }
.item img.cover { object-fit: contain; padding: 3px; }
.item strong { display: block; line-height: 1.2; }
.item small { color: var(--muted); font-variant-numeric: tabular-nums; }
.item button { border: 0; background: none; color: var(--warn); font-weight: 600; padding: .5rem; text-decoration: underline; text-underline-offset: 3px; }
.total { display: flex; justify-content: space-between; align-items: baseline; font-size: 1.2rem; font-weight: 800; padding-top: .4rem; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.list-actions { display: grid; gap: .55rem; }
.hint { color: var(--muted); font-size: .9rem; }

.toast {
  position: fixed; left: 50%; bottom: 5.5rem; transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: var(--paper); padding: .65rem 1rem; border-radius: 12px; font-weight: 600;
  box-shadow: 0 10px 30px -10px rgb(0 0 0 / .5);
}
.toast[hidden] { display: none; }
.noscript { padding: 1rem; background: var(--sticker); color: var(--sticker-ink); text-align: center; font-weight: 600; }

/* Celular: janela ocupa a tela inteira */
@media (max-width: 859px) {
  dialog.sheet { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; margin: 0; }
  dialog.sheet.narrow { height: auto; max-height: 92dvh; margin: auto 0 0; border-radius: 20px 20px 0 0; }
  .stage { aspect-ratio: 1 / 1; max-height: 62dvh; }
  .actions { padding-bottom: max(.6rem, env(safe-area-inset-bottom)); }
}

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