/* Fabestonia — "The Arena Ledger"
   Flesh and Blood community: warm obsidian arena, bone parchment text,
   gold for victory/structure, blood-crimson for action/defeat. */

:root {
  --ink:        #14100b;  /* arena background (warm near-black) */
  --ink-2:      #1d1711;  /* card / surface */
  --ink-3:      #271f16;  /* inputs / elevated */
  --line:       #3a2e1f;  /* warm gold-tinted hairline */
  --line-soft:  #2c2317;
  --bone:       #ece3cf;  /* primary text (parchment/bone) */
  --bone-dim:   #a4967b;  /* muted text */
  --gold:       #c9a25a;
  --gold-bright:#e7c67d;
  --gold-deep:  #8a6d34;
  --blood:      #a02a22;
  --blood-bright:#c5392e;

  --r: 4px;               /* restrained radius — these are card frames, not pills */
  --shadow: 0 18px 40px -22px rgba(0,0,0,0.85);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1200px 620px at 50% -340px, rgba(201,162,90,0.10), transparent 70%),
    var(--ink);
  background-attachment: fixed;
  color: var(--bone);
  font-family: 'Spectral', Georgia, 'Times New Roman', serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--gold-bright); text-decoration: none; }
a:hover { color: var(--gold); text-decoration: underline; text-underline-offset: 3px; }

/* ---- Headings: Cinzel, engraved heraldry ---- */
h1, h2, h3 {
  font-family: 'Cinzel', 'Spectral', Georgia, serif;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin: 0 0 0.75rem;
  color: var(--bone);
}

.page-title {
  font-size: clamp(1.6rem, 3.5vw, 2.3rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-bottom: 0.4rem;
}

/* Section headers get a heraldic lozenge + trailing hairline. */
h2 {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-top: 2rem;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--gold);
}
h2::before {
  content: "";
  width: 8px; height: 8px;
  flex: 0 0 auto;
  background: var(--gold);
  transform: rotate(45deg);
  box-shadow: 0 0 10px rgba(201,162,90,0.5);
}
h2::after {
  content: "";
  height: 1px; flex: 1;
  background: linear-gradient(90deg, var(--line), transparent);
}

h3 { font-size: 1.05rem; letter-spacing: 0.03em; }

/* ---- Top bar ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.7rem 1.5rem;
  background: linear-gradient(180deg, rgba(40,32,22,0.96), rgba(20,16,11,0.96));
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(201,162,90,0.12);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
  backdrop-filter: blur(6px);
}
.topbar .brand { display: inline-flex; align-items: center; flex: 0 0 auto; }
.topbar .brand img { display: block; width: auto; height: 40px; max-width: 220px; object-fit: contain; }
.topbar nav { display: flex; gap: 1.4rem; flex: 1 1 auto; min-width: 0; flex-wrap: wrap; }
.topbar nav a {
  color: var(--bone-dim);
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
}
.topbar nav a:hover { color: var(--gold-bright); text-decoration: none; border-bottom-color: var(--gold-deep); }
/* Página atual: o mesmo filete de ouro do hover, mas fixo. */
.topbar nav a.is-current { color: var(--gold-bright); border-bottom-color: var(--gold); }
.topbar .account { display: flex; align-items: center; gap: 0.75rem; flex: 0 0 auto; margin-left: auto; white-space: nowrap; }
.topbar .who { color: var(--bone-dim); font-size: 0.9rem; font-family: 'Cinzel', serif; letter-spacing: 0.04em; }
.topbar .who:hover { color: var(--gold-bright); }

/* Hamburger: hidden on desktop, shown under the nav-fit breakpoint. */
.nav-toggle {
  display: none;
  flex: 0 0 auto;
  margin-left: auto;
  width: 2.7rem;
  height: 2.7rem;
  padding: 0;
  align-items: center;
  justify-content: center;
  background: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
}
.nav-toggle:hover { border-color: var(--gold); }
.nav-toggle-bars { position: relative; }
.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  content: "";
  display: block;
  width: 1.15rem;
  height: 2px;
  background: var(--gold);
  transition: transform 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}
.nav-toggle-bars::before { position: absolute; left: 0; top: -6px; }
.nav-toggle-bars::after  { position: absolute; left: 0; top: 6px; }
.topbar.nav-open .nav-toggle-bars { background: transparent; }
.topbar.nav-open .nav-toggle-bars::before { top: 0; transform: rotate(45deg); }
.topbar.nav-open .nav-toggle-bars::after  { top: 0; transform: rotate(-45deg); }

/* ---- Layout ---- */
.content { max-width: 1040px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }
.muted { color: var(--bone-dim); }

/* ---- Cards (card frames) ---- */
.card {
  position: relative;
  display: block;
  background:
    linear-gradient(180deg, rgba(201,162,90,0.05), transparent 120px),
    var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 1.1rem 1.3rem;
  margin-bottom: 1rem;
  color: var(--bone);
  box-shadow: var(--shadow);
}
/* Gold frame-rule across the top of every card */
.card::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-deep) 18%, var(--gold) 50%, var(--gold-deep) 82%, transparent);
  opacity: 0.55;
  border-radius: var(--r) var(--r) 0 0;
}
a.card { transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease; }
a.card:hover {
  border-color: var(--gold-deep);
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--shadow), 0 0 0 1px rgba(201,162,90,0.25);
}
a.card:hover::before { opacity: 1; }
a.card h3 { color: var(--gold-bright); }

.grid { display: grid; gap: 1rem; }
.grid.cols-2 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

/* Title + inline badge on one line (keeps cards equal height) */
.card-title { display: flex; align-items: center; gap: 0.5rem; margin: 0; }
.card-title .badge { margin-left: auto; }

/* ---- Tables ---- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.6rem 0.7rem; border-bottom: 1px solid var(--line-soft); }
th {
  color: var(--gold);
  font-family: 'Cinzel', serif;
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  border-bottom: 1px solid var(--line);
}
tbody tr { transition: background 0.12s ease; }
tbody tr:hover { background: rgba(201,162,90,0.045); }
td a { color: var(--bone); }
td a:hover { color: var(--gold-bright); }

/* ---- Buttons ---- */
.btn {
  display: inline-block;
  cursor: pointer;
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  background: var(--ink-3);
  color: var(--bone);
  padding: 0.55rem 1.05rem;
  border-radius: var(--r);
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.btn:hover { border-color: var(--gold); color: var(--gold-bright); text-decoration: none; }
.btn.primary {
  background: linear-gradient(180deg, var(--blood-bright), var(--blood));
  border-color: var(--blood);
  color: #fbeee9;
}
.btn.primary:hover { border-color: var(--gold); color: #fff; filter: brightness(1.08); }
.btn.gold {
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  border-color: var(--gold);
  color: #1a130a;
}
.btn.gold:hover { color: #1a130a; filter: brightness(1.08); }
.btn.discord { background: #5865f2; border-color: #5865f2; color: #fff; }
.btn.discord:hover { color: #fff; border-color: #fff; }
.btn.ghost { background: transparent; }
.btn.danger { border-color: var(--blood); color: var(--blood-bright); background: transparent; }
.btn.danger:hover { background: var(--blood); color: #fff; border-color: var(--blood); }
.btn.sm { padding: 0.3rem 0.65rem; font-size: 0.68rem; }

/* ---- Forms ---- */
input, select, textarea {
  background: var(--ink-3);
  border: 1px solid var(--line);
  color: var(--bone);
  border-radius: var(--r);
  padding: 0.5rem 0.65rem;
  font-family: 'Spectral', Georgia, serif;
  font-size: 0.95rem;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(201,162,90,0.2);
}
label {
  display: block;
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--bone-dim);
  margin-bottom: 0.3rem;
}
.field { margin-bottom: 0.85rem; }
.row { display: flex; gap: 0.85rem; flex-wrap: wrap; align-items: flex-end; }
label.radio {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.2rem;
  font-family: 'Spectral', Georgia, serif;
  font-size: 0.9rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--bone);
}
label.radio input {
  width: auto;
  margin: 0;
  padding: 0;
}

/* ---- Badges ---- */
.badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-family: 'Cinzel', serif;
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge.available { background: rgba(201,162,90,0.14); color: var(--gold-bright); border-color: var(--gold-deep); }
.badge.reserved  { background: rgba(197,57,46,0.14);  color: var(--blood-bright); border-color: var(--blood); }
.badge.delivered { background: rgba(164,150,123,0.12); color: var(--bone-dim); border-color: var(--line); }
.badge.admin     { background: rgba(201,162,90,0.14); color: var(--gold-bright); border-color: var(--gold-deep); }
.badge.foil      { background: linear-gradient(90deg, rgba(201,162,90,0.18), rgba(197,57,46,0.14)); color: var(--gold-bright); border-color: var(--gold-deep); }
.badge.live      { background: rgba(197,57,46,0.18); color: var(--blood-bright); border-color: var(--blood); }
.badge.live::before {
  content: "";
  display: inline-block;
  width: 0.5em; height: 0.5em;
  margin-right: 0.4em;
  border-radius: 50%;
  background: var(--blood-bright);
  vertical-align: middle;
  animation: live-pulse 1.4s ease-in-out infinite;
}
@keyframes live-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.2; } }

/* ---- Win/Loss meter: gold (victory) vs blood (defeat) ---- */
.bar {
  height: 12px;
  border-radius: 999px;
  background: var(--ink-3);
  border: 1px solid var(--line);
  overflow: hidden;
  display: flex;
  margin: 0.6rem 0;
}
.bar .seg-win  { background: linear-gradient(180deg, var(--gold-bright), var(--gold)); }
.bar .seg-loss { background: linear-gradient(180deg, var(--blood-bright), var(--blood)); }

/* ---- Flash messages ---- */
.flash { padding: 0.75rem 1rem; border-radius: var(--r); margin-bottom: 1.25rem; font-size: 0.95rem; }
.flash.success { background: rgba(201,162,90,0.12); border: 1px solid var(--gold-deep); color: var(--gold-bright); }
.flash.error   { background: rgba(197,57,46,0.12); border: 1px solid var(--blood); color: var(--blood-bright); }
.error { color: var(--blood-bright); }

/* ---- Toasts (feedback flutuante das ações via fetch, assets/toast.js) ---- */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
  pointer-events: none;
}
.toast {
  padding: 0.75rem 1.25rem;
  border-radius: var(--r);
  font-size: 0.95rem;
  max-width: min(90vw, 32rem);
  text-align: center;
  background: var(--ink-2); /* fundo opaco: o toast flutua sobre o conteúdo */
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translateY(0.5rem);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { border: 1px solid var(--gold-deep); color: var(--gold-bright); }
.toast.error   { border: 1px solid var(--blood); color: var(--blood-bright); }

/* Toast com ação (ex.: "Undo" do binder) — só ele volta a receber cliques,
   já que o container inteiro é pointer-events:none. */
.toast.has-action {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  text-align: left;
  pointer-events: auto;
}
.toast-action {
  flex: none;
  background: none;
  border: 1px solid currentColor;
  border-radius: var(--r);
  color: inherit;
  font: inherit;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.25rem 0.7rem;
  cursor: pointer;
}
.toast-action:hover { background: rgba(231, 198, 125, 0.14); }

/* ---- Home hero ---- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 3rem 2rem 2.6rem;
  text-align: center;
  background:
    radial-gradient(700px 320px at 50% -60px, rgba(201,162,90,0.16), transparent 70%),
    linear-gradient(180deg, rgba(160,42,34,0.12), transparent 55%),
    var(--ink-2);
}
.hero .eyebrow {
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 1rem;
}
.hero h1 {
  font-size: 2.8rem; /* tamanho fixo — não "pula" com a largura nem ao trocar a fonte */
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.15;
  margin: 0 auto 0.9rem;
  max-width: 16ch;
}
.hero .lede {
  color: var(--bone-dim);
  font-size: 1.05rem;
  max-width: 54ch;
  margin: 0 auto 1.7rem;
}
.hero .actions { display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; }
.hero-logo { display: block; width: min(100%, 460px); height: auto; margin: 0 auto 1.4rem; }

/* ---- Hero portraits ---- */
.hero-portrait {
  border-radius: var(--r);
  object-fit: cover;
  vertical-align: middle;
  background: var(--ink-3);
  border: 1px solid var(--line);
}
.hero-portrait-sm { width: 30px; height: 30px; }
.hero-portrait-lg { width: 60px; height: 60px; }
.hero-line { display: inline-flex; align-items: center; gap: 0.55rem; }
.hero-line p { margin: 0; }

/* ---- Card catalog: thumbnails, listing layout, search ---- */
.card-thumb {
  width: 86px;
  height: 120px;
  object-fit: contain;
  border-radius: var(--r);
  background: var(--ink-3);
  border: 1px solid var(--line);
  flex: 0 0 auto;
}
.listing-body { display: flex; gap: 0.9rem; align-items: flex-start; margin-top: 0.4rem; }
.listing-body > div { flex: 1 1 auto; min-width: 0; }
.listing-body p { margin: 0 0 0.35rem; }

/* ---- Marketplace: trade slips ----
   Hierarquia: o preço é a ÚNICA marca de ouro do anúncio — nome e metadados
   ficam em osso, o preço em Cinzel com algarismos tabulares. Compactos:
   miniatura menor, uma linha de metadados, padding justo. */
.listing { padding: 0.8rem 0.9rem; }
.listing h3 { font-size: 0.98rem; }
.listing .card-thumb { width: 72px; height: 100px; }
.listing .listing-body { font-size: 0.88rem; }       /* metadados herdam; o preço se impõe */
.listing .listing-body .badge { font-size: 0.6rem; }
.grid#listing-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.listing .listing-price {
  margin: 0.15rem 0 0.45rem;
  font-family: 'Cinzel', serif;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.1;
  color: var(--gold-bright);
  font-variant-numeric: tabular-nums;
}
.listing .listing-price .cur {
  margin-right: 0.12em;
  font-size: 0.68em;
  color: var(--gold);
}
.listing .listing-price.free {
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--bone-dim);
}
/* CM Lowest: preço acordado pelo menor do Cardmarket — estado com valor, em ouro */
.listing .listing-price.cm {
  font-size: 0.86rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-bright);
}
/* O rótulo leva à busca da carta no Cardmarket (nova aba) */
.listing-price.cm a { color: inherit; }
.listing-price.cm a:hover { color: var(--gold); text-decoration: underline; text-underline-offset: 3px; }
/* Seta de "abre noutra aba" em links externos (Cardmarket, Google Play…). */
.ext { margin-left: 0.25em; font-size: 0.85em; opacity: 0.7; }
.listing-price.cm .ext { margin-left: 0.25em; font-size: 0.85em; opacity: 0.65; }
.listing-price.cm a:hover .ext { opacity: 1; }

/* ---- Marketplace: alternância grid / lista ----
   Dois links (a troca recarrega a página: quem decide o markup é o servidor).
   Pílula em latão, ouro cheio no modo ativo — mesma linguagem de .filter-chip. */
.view-toggle { display: flex; gap: 0.3rem; margin-left: auto; }
.view-btn {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.22rem 0.7rem;
  font-family: 'Cinzel', serif; font-size: 0.7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--bone-dim);
  background: var(--ink-3);
  border: 1px solid var(--gold-deep);
  border-radius: 999px;
}
.view-btn:hover { color: var(--gold-bright); border-color: var(--gold); text-decoration: none; }
.view-btn.is-active {
  color: var(--ink);
  background: var(--gold);
  border-color: var(--gold);
}
.view-btn.is-active:hover { color: var(--ink); }

/* ---- Marketplace: vitrine em lista (tabela) ----
   Herda th/td/hover de .set-table e o empilhamento no celular de .table-cards;
   aqui só larguras de coluna e o ajuste de escala do card para a linha. */
.listing-table .lt-thumb { width: 52px; padding-right: 0; }
.listing-table .card-thumb { width: 40px; height: 56px; }
.listing-table .lt-card strong { color: var(--bone); }
.listing-table .lt-card .badge { margin-left: 0.4rem; vertical-align: 1px; }
.listing-table .facet-row { margin: 0.25rem 0 0; gap: 0.25rem; }
.listing-table .badge.facet { font-size: 0.58rem; }
.listing-table .lt-code { white-space: nowrap; width: 6rem; color: var(--bone-dim); }
.listing-table .lt-qty { width: 5.5rem; }
.listing-table .lt-owner { overflow-wrap: anywhere; }
.listing-table .lt-actions { white-space: nowrap; }
.listing-table .lt-actions .row { gap: 0.35rem; flex-wrap: nowrap; }
/* O preço mantém o ouro em Cinzel do card, num degrau menor para caber na linha */
.listing-table .listing-price { display: inline-block; margin: 0; font-size: 1.05rem; }
.listing-table .listing-price.free,
.listing-table .listing-price.cm { font-size: 0.76rem; }
/* Editar in-place: os 4 campos precisam caber sem esticar a coluna Ações */
.listing-table .listing-edit { margin-top: 0.3rem; }
.listing-table .listing-edit .row {
  flex-wrap: wrap; white-space: normal;
  width: 20rem; max-width: 100%; gap: 0.4rem;
}
.listing-table .listing-edit .field { flex: 1 1 8rem; }
.listing-table .listing-empty-row td { border-bottom: none; padding: 1.5rem 0.6rem; }
.listing-table .listing-empty-row:hover td { background: none; }

/* Balcão de filtros: régua de latão com busca + facetas (classe/talento/etc.) */
.market-filters {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
  padding: 0.8rem 0.9rem;
  background:
    linear-gradient(180deg, rgba(201,162,90,0.05), transparent 55%),
    var(--ink-2);
  border: 1px solid var(--gold-deep);
  border-radius: var(--r);
}
.mf-search { display: flex; gap: 0.5rem; }
.mf-search input { flex: 1 1 auto; min-width: 0; }
.mf-search .btn { flex: 0 0 auto; }
.mf-selects { display: flex; flex-wrap: wrap; gap: 0.6rem 0.7rem; align-items: flex-end; }
/* mf-field/mf-check são <label>: neutraliza o estilo global de label */
.mf-field {
  display: flex; flex-direction: column; gap: 0.2rem;
  margin: 0; text-transform: none; letter-spacing: 0;
}
.mf-field > span {
  font-family: 'Cinzel', serif; font-size: 0.62rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--gold);
}
.mf-field select { width: auto; min-width: 8.5rem; padding: 0.4rem 0.55rem; font-size: 0.88rem; }
.mf-check {
  display: inline-flex; align-items: center; gap: 0.4rem;
  margin: 0 0 0.15rem; font-family: 'Spectral', Georgia, serif;
  font-size: 0.88rem; text-transform: none; letter-spacing: 0; color: var(--bone);
}
.mf-check input { width: auto; }
@media (max-width: 560px) {
  .mf-field { flex: 1 1 8rem; }
  .mf-field select { width: 100%; min-width: 0; }
  .mf-check { flex: 1 1 100%; }
}

/* Resumo de resultados + chips de filtros ativos (marketplace e binder) */
.filter-summary {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 0.5rem 0.9rem; margin-bottom: 1.1rem;
}
.filter-count {
  font-family: 'Cinzel', serif; font-size: 0.9rem;
  letter-spacing: 0.03em; color: var(--gold-bright);
}
/* Wrapper fixo dos chips, para o JS dos filtros trocar só o conteúdo.
   display:contents mantém os chips como filhos diretos do flex do resumo — sem
   isso, o wrapper viraria um item de flex e a linha quebraria diferente. */
#filter-chips-slot { display: contents; }

/* Ordenação: mesma família visual dos filtros, mas deitado, porque aqui ele
   divide a linha com o contador e o toggle de vitrine. Empurra a si mesmo (e o
   toggle logo depois) para a direita — o toggle já tinha margin-left:auto, e
   dois autos na mesma linha dividiriam o espaço em dois vãos. */
.mf-sort {
  display: inline-flex; align-items: center; gap: 0.4rem;
  margin: 0; text-transform: none; letter-spacing: 0;
}
.mf-sort > span {
  font-family: 'Cinzel', serif; font-size: 0.62rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--gold);
}
.mf-sort select { width: auto; padding: 0.3rem 0.5rem; font-size: 0.85rem; }
.filter-summary .mf-sort { margin-left: auto; }
.filter-summary .mf-sort + .view-toggle { margin-left: 0; }

/* Botão Apply do <noscript>: sem JS é ele que aplica filtro e ordenação. */
.mf-apply { display: flex; }

/* Enquanto a vitrine é trocada por fetch, ela esmaece — o suficiente para
   perceber que algo está acontecendo sem fazer a página pular. */
#listing-region[aria-busy="true"] { opacity: 0.55; transition: opacity 0.12s ease; }

.filter-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.22rem 0.6rem;
  font: inherit; font-size: 0.78rem; line-height: 1.35;
  color: var(--bone);
  background: var(--ink-3);
  border: 1px solid var(--gold-deep);
  border-radius: 999px;
  cursor: pointer;
  -webkit-appearance: none; appearance: none;
}
.filter-chip:hover { border-color: var(--gold); color: var(--gold-bright); text-decoration: none; }

/* Paginação. Estava em style inline no marketplace.php, o que impedia o bloco
   de alvos de toque (lá embaixo) de alcançar o gap e a largura dos números. */
.pagination {
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 1.5rem;
}
.filter-chip b { color: var(--gold); font-weight: 600; }
.filter-chip-x { color: var(--bone-dim); font-size: 0.95rem; line-height: 1; }
.filter-chip:hover .filter-chip-x { color: var(--blood-bright); }
.filter-chip-clear { background: transparent; border-style: dashed; color: var(--bone-dim); }
.filter-chip-clear:hover { color: var(--blood-bright); border-color: var(--blood); }

/* Linha de facetas no card do anúncio (classe/talento/raridade/foil) */
.facet-row { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0 0 0.4rem; }
.badge.facet { font-size: 0.6rem; padding: 0.12rem 0.5rem; letter-spacing: 0.08em; }
.badge.facet-class  { background: rgba(201,162,90,0.14); color: var(--gold-bright); border-color: var(--gold-deep); }
.badge.facet-talent { background: rgba(197,57,46,0.13); color: var(--blood-bright); border-color: var(--blood); }
.badge.facet-rarity { background: rgba(164,150,123,0.12); color: var(--bone); border-color: var(--line); }
.listing-detail { font-size: 0.82rem; }
/* OBS do vendedor: detalhe da cópia física (idioma, assinatura, desgaste) que o
   catálogo não tem. Itálico em osso para não competir com o preço em ouro. */
.listing-notes {
  margin: 0 0 0.4rem;
  padding-left: 0.55rem;
  border-left: 2px solid var(--gold-deep);
  font-size: 0.82rem;
  font-style: italic;
  line-height: 1.45;
  color: var(--bone);
}
.listing-table .listing-notes { margin: 0.3rem 0 0; font-size: 0.78rem; }
.empty-state { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 0.6rem; }

/* Miniatura da carta: convida ao hover para ampliar (só no desktop) */
@media (hover: hover) and (pointer: fine) {
  .listing .card-thumb { cursor: zoom-in; }
}
/* Preview flutuante da carta ampliada (posicionado via JS perto do cursor) */
.card-preview {
  position: fixed; left: 0; top: 0; z-index: 200;
  width: 320px; max-width: 60vw; height: auto;
  border-radius: 8px;
  border: 1px solid var(--gold-deep);
  box-shadow: 0 14px 44px -10px rgba(0,0,0,0.9);
  background: var(--ink-2);
  opacity: 0; visibility: hidden;
  pointer-events: none;
  transition: opacity 0.12s ease;
}
.card-preview.show { opacity: 1; visibility: visible; }

/* Versão para toque do preview acima: no celular não há hover, então a carta
   abre centralizada por cima da página e fecha ao tocar fora. */
.card-zoom {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 1.25rem;
  background: rgba(10, 7, 4, 0.88);
  opacity: 0; visibility: hidden;
  transition: opacity 0.15s ease;
}
.card-zoom.show { opacity: 1; visibility: visible; }
.card-zoom img {
  max-width: 100%; max-height: 100%;
  width: auto; height: auto;
  border-radius: 8px;
  border: 1px solid var(--gold-deep);
  box-shadow: var(--shadow);
}
/* Só o toque abre a lupa, então só aí o cursor deve sugerir isso. */
@media (pointer: coarse) {
  .listing .card-thumb { cursor: zoom-in; }
}

/* ---- Bulk add / wishlist ---- */
.bulk-textarea { font-family: 'Spectral', Georgia, serif; line-height: 1.5; resize: vertical; }
.card-thumb-sm {
  width: 40px;
  height: 56px;
  object-fit: contain;
  border-radius: var(--r);
  background: var(--ink-3);
  border: 1px solid var(--line);
  flex: 0 0 auto;
}
.wishlist-row {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  padding: 0.5rem 0;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
  cursor: pointer;
}
.wishlist-row:first-of-type { border-top: none; }
.wishlist-row input[type="checkbox"] { width: auto; flex: 0 0 auto; }
.wishlist-row > span { flex: 1 1 auto; min-width: 0; }

/* ---- Reservation detail (large, low-clutter, dyslexia/ADHD friendly) ---- */
.reservation-summary { font-size: 1.15rem; line-height: 1.7; margin: 0 0 1.4rem; }
.big-num {
  font-family: 'Cinzel', serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--gold-bright);
  vertical-align: -0.1em;
}
.res-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.6rem;
}
.res-tile {
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 0.9rem;
  text-align: center;
}
.res-tile-img { position: relative; display: inline-block; }
.card-thumb-lg {
  width: 100%;
  max-width: 220px;
  height: auto;
  object-fit: contain;
  border-radius: var(--r);
  background: var(--ink-3);
  border: 1px solid var(--line);
}
.qty-badge {
  position: absolute;
  top: -0.7rem;
  right: -0.7rem;
  min-width: 2.6rem;
  height: 2.6rem;
  padding: 0 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gold-bright);
  color: var(--ink);
  font-family: 'Cinzel', serif;
  font-size: 1.5rem;
  font-weight: 700;
  border-radius: 999px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}
.res-tile-name { font-size: 1.1rem; margin: 0.7rem 0 0.2rem; }
.res-tile-meta { color: var(--bone-dim); font-size: 0.9rem; margin: 0 0 0.3rem; }
.res-tile-price { font-size: 1.05rem; margin: 0 0 0.6rem; }

/* Item sem carta do catálogo: sem tcgplayer_id não há arte e o tile ficaria oco.
   Um marcador tracejado ocupa o lugar da imagem e aponta onde está o conserto. */
.res-tile.no-art { border-color: var(--gold-deep); }
.res-tile.no-art .res-tile-img {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 220px;
  min-height: 170px;
  padding: 1rem;
  background: var(--ink-3);
  border: 1px dashed var(--gold-deep);
  border-radius: var(--r);
}
.no-art-hint {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  line-height: 1.6;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--bone-dim);
}

/* Corrigir o nome de um item (só o dono) — re-casa com o catálogo ao salvar */
.tile-edit { margin-top: 0.5rem; text-align: left; }
.tile-edit > summary { cursor: pointer; font-size: 0.78rem; }
.tile-edit-form { display: flex; gap: 0.4rem; margin-top: 0.45rem; }
.tile-edit-form input { flex: 1 1 auto; min-width: 0; font-size: 0.9rem; }
.tile-edit-form .btn { flex: 0 0 auto; }

/* ---- List by set (table) ---- */
.set-table { width: 100%; border-collapse: collapse; }
.set-table th {
  text-align: left;
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--bone-dim);
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--line);
}
.set-table td { padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.set-table tr:hover td { background: var(--ink-2); }
.set-thumb-cell { width: 48px; }
.set-num { color: var(--bone-dim); white-space: nowrap; }
.set-qty { width: 5rem; }
.set-cond { width: 6rem; }
.set-price { width: 7rem; }
.set-table .btn { display: inline; }

/* ---- CSV import (review table) ---- */
.csv-table .csv-edition { margin-top: 0.3rem; max-width: 22rem; font-size: 0.85rem; }
.csv-table td:first-child { width: 3rem; text-align: center; }
.csv-table input[type='checkbox'] { width: 1.05rem; height: 1.05rem; accent-color: var(--gold); }
.csv-table input:disabled { opacity: 0.45; }

.card-results {
  position: absolute;
  left: 0; right: 0; top: 100%;
  z-index: 20;
  margin-top: 4px;
  max-height: 320px;
  overflow-y: auto;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}
.card-result {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 100%;
  text-align: left;
  cursor: pointer;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 0;
  color: var(--bone);
  font-family: 'Spectral', Georgia, serif;
  text-transform: none;
  letter-spacing: 0;
  padding: 0.5rem 0.7rem;
}
.card-result:last-child { border-bottom: none; }
.card-result:hover { background: rgba(201,162,90,0.1); color: var(--gold-bright); }
.card-result small { color: var(--bone-dim); font-size: 0.78rem; }

/* Wide tables (rounds, rosters, set lists) scroll sideways instead of
   bursting the card frame on narrow screens. */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll > table { margin: 0; }
.set-table { min-width: 560px; }
.csv-table { min-width: 760px; }

/* ---- Tournament: stat strip ---- */
.stat-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  margin: 1.1rem 0 0.4rem;
  background: var(--line-soft);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
.stat {
  flex: 1 1 130px;
  padding: 0.85rem 1.15rem;
  background: var(--ink-2);
  display: flex;
  flex-direction: column;
  justify-content: flex-end; /* base-align value + label so all tiles share a line */
}
.stat .num {
  font-family: 'Cinzel', serif;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
  color: var(--gold-bright);
}
.stat .num.text { font-size: 1.05rem; letter-spacing: 0.02em; line-height: 1.2; }
.stat .num.crimson { color: var(--blood-bright); }
.stat .lbl {
  margin-top: 0.4rem;
  font-family: 'Cinzel', serif;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--bone-dim);
}

/* ---- Tournament: round tabs ---- */
.tabs {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* swipe to reach older rounds; no chrome scrollbar track */
  border-bottom: 1px solid var(--line);
  margin-bottom: 1rem;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  flex: 0 0 auto;
  cursor: pointer;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 0.55rem 0.9rem;
  color: var(--bone-dim);
  font-family: 'Cinzel', serif;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.tabs button:hover { color: var(--gold-bright); }
.tabs button[aria-selected="true"] { color: var(--gold-bright); border-bottom-color: var(--gold); }
.tab-panels > [role="tabpanel"] { margin-bottom: 0; }
/* The panel carries .card (display:block), which outranks the UA [hidden] rule.
   This selector (0,3,0) wins, so a hidden panel actually stays hidden. */
.tab-panels > [role="tabpanel"][hidden] { display: none; }

/* ---- Tournament: match winner emphasis ---- */
td.match-w a { color: var(--gold-bright); }
td.match-l { color: var(--bone-dim); }
td.match-l a { color: var(--bone-dim); }
.win-mark { color: var(--gold); font-size: 0.85em; }
.bye-row { background: rgba(201,162,90,0.04); }
.bye-row td.muted { font-style: italic; }
.res-tag {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
}
.res-tag.win { color: var(--gold-bright); }
.res-tag.bye { color: var(--gold-deep); }
.res-tag.draw { color: var(--bone-dim); }
.res-tag.pending { color: var(--bone-dim); font-style: italic; }

/* ---- Tournament: the Campaign Trail (per-round pips) ---- */
.record { display: inline-flex; gap: 0.5rem; font-family: 'Cinzel', serif; font-size: 0.82rem; }
.record .w { color: var(--gold-bright); }
.record .l { color: var(--blood-bright); }
.record .d { color: var(--bone-dim); }
.record .b { color: var(--gold-deep); font-size: 0.92em; } /* bye = win */
.score { font-family: 'Cinzel', serif; font-weight: 700; font-size: 1.05rem; color: var(--gold-bright); }

.trail { display: inline-flex; gap: 3px; }
.pip {
  flex: 0 0 auto;
  width: 1.3rem;
  height: 1.3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cinzel', serif;
  font-size: 0.6rem;
  font-weight: 700;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--ink-3);
  color: var(--bone-dim);
}
.pip-w { background: linear-gradient(180deg, var(--gold-bright), var(--gold)); border-color: var(--gold); color: #1a130a; }
.pip-l { background: linear-gradient(180deg, var(--blood-bright), var(--blood)); border-color: var(--blood); color: #fbeee9; }
.pip-d { background: var(--ink-3); border-color: var(--bone-dim); color: var(--bone-dim); }
/* Bye = a win: gold family, faded vs the solid pip-w. */
.pip-b { background: rgba(201,162,90,0.16); border-color: var(--gold-deep); color: var(--gold-bright); }
.pip-p { background: transparent; border: 1px dashed var(--gold-deep); color: var(--gold); }
.pip-bye { background: transparent; border-style: dotted; border-color: var(--line); color: var(--bone-dim); }
.trail-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
  margin: 0.9rem 0 0;
  color: var(--bone-dim);
  font-size: 0.78rem;
}
.trail-legend .pip { margin-right: 0.1rem; }

/* ---- Want-list: shareable link box + acquired cards ---- */
/* ---- Página de um anúncio (listing.php) ----
   Arte grande à esquerda, dados e ações à direita; empilha no celular. */
.listing-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: flex-start;
  margin-bottom: 2rem;
}
.listing-detail-art { flex: 0 1 300px; min-width: 0; }
.listing-detail-img {
  width: 100%; height: auto; display: block;
  border-radius: 6px;
  border: 1px solid var(--gold-deep);
  box-shadow: var(--shadow);
}
.listing-detail-noart {
  display: flex; align-items: center; justify-content: center;
  aspect-ratio: 5 / 7;
  background: var(--ink-3);
  border: 1px dashed var(--line);
  border-radius: 6px;
  font-size: 0.85rem;
}
/* min-width:0 impede a coluna de dados de estourar a linha por causa de um
   nome de carta comprido. */
.listing-detail-info { flex: 1 1 320px; min-width: 0; }
.listing-detail-info .listing-price { font-size: 1.35rem; margin: 0.5rem 0 1rem; }

.listing-detail-table { width: 100%; margin: 0 0 1.1rem; }
.listing-detail-table th {
  width: 8.5rem;
  text-align: left;
  vertical-align: top;
  font-family: 'Cinzel', serif;
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold);
  padding: 0.4rem 0.6rem 0.4rem 0;
  border-bottom: 1px solid var(--line-soft);
}
.listing-detail-table td {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--line-soft);
}
.listing-detail-actions { margin-bottom: 1.2rem; align-items: flex-end; }

.listing-share { margin-top: 1.2rem; }
.listing-share label {
  display: block;
  margin-bottom: 0.35rem;
}
/* "Ver no fichário": botão pequeno, presente só quando o anúncio veio de um
   fichário. Fica separado dos botões de ação de propósito — aqueles mudam o
   estado do anúncio, este só leva a olhar a foto real da carta. */
.listing-peek { margin: 0.5rem 0 0.35rem; }
.binder-peek { display: inline-flex; align-items: center; gap: 0.35rem; }
/* Na vitrine em lista ele divide a célula de ações com os forms (que são
   blocos): a margem evita que fique colado neles. */
.lt-actions .binder-peek { margin-bottom: 0.35rem; }

/* Título clicável do anúncio na vitrine (leva ao detalhe). Herda a cor do
   heading para não virar um link azul no meio do card. */
.listing-title { color: inherit; }
.listing-title:hover { color: var(--gold-bright); }
/* Na lista de "mesma carta", destaca quem é a MESMA impressão — é com essas que
   a comparação de preço é justa. */
.listing-table tr.is-same-print { background: rgba(201, 162, 90, 0.07); }

@media (max-width: 640px) {
  .listing-detail { gap: 1rem; }
  /* A arte ocupa a linha inteira, mas com teto: uma carta de tela cheia empurra
     preço e botões para fora da primeira dobra. */
  .listing-detail-art { flex: 1 1 100%; max-width: 260px; margin: 0 auto; }
  .listing-detail-table th { width: 7rem; font-size: 0.62rem; }
}

.share-box { display: flex; gap: 0.5rem; align-items: stretch; }
.share-box input { flex: 1 1 auto; min-width: 0; font-family: 'Spectral', Georgia, serif; }
.share-box .btn { flex: 0 0 auto; }
.res-tile.got { opacity: 0.5; }
.res-tile.got .res-tile-name { text-decoration: line-through; text-decoration-color: var(--bone-dim); }
.got-line { margin: 0.1rem 0 0; font-size: 0.92rem; color: var(--bone-dim); }
.got-line.some { color: var(--gold-bright); }
.got-line.all { color: #66bb6a; }
.got-form { display: flex; align-items: center; justify-content: center; gap: 0.45rem; margin-top: 0.55rem; }
.got-form .got-lbl {
  margin: 0;
  font-family: 'Cinzel', serif;
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bone-dim);
}
.got-input { width: 4.2rem; text-align: center; }
.got-quick { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4rem; margin-top: 0.4rem; }

/* Visitor "I have these" tiles with a quantity stepper */
.res-tile.have.sel { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(201, 162, 90, 0.45); }
.res-tile.have .sel-check,
.res-tile.have .sel-partial {
  position: absolute;
  top: -0.7rem; left: -0.7rem;
  width: 2.4rem; height: 2.4rem;
  display: none; align-items: center; justify-content: center;
  font-size: 1.4rem; font-weight: 700;
  border-radius: 999px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}
.res-tile.have .sel-check { background: #2e7d32; color: #fff; }       /* todas as que faltam */
.res-tile.have .sel-partial { background: #e8a13a; color: #1a130a; }  /* parcial */
.res-tile.have.full .sel-check { display: flex; }
.res-tile.have.partial .sel-partial { display: flex; }
.res-tile.have .have-stepper { display: flex; align-items: center; justify-content: center; gap: 0.5rem; margin-top: 0.55rem; }
.res-tile.have .step-btn {
  width: 2.1rem; height: 2.1rem; padding: 0; flex: 0 0 auto;
  font-family: 'Cinzel', serif; font-size: 1.1rem; line-height: 1; cursor: pointer;
  background: var(--ink-3); color: var(--bone);
  border: 1px solid var(--line); border-radius: var(--r);
}
.res-tile.have .step-btn:hover { border-color: var(--gold); color: var(--gold-bright); }
.res-tile.have .have-input { width: 3rem; text-align: center; }
.res-tile.have .have-cap { margin-top: 0.25rem; font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--bone-dim); }
.got-check {
  position: absolute;
  top: -0.7rem; left: -0.7rem;
  width: 2.4rem; height: 2.4rem;
  display: flex; align-items: center; justify-content: center;
  background: #2e7d32; color: #fff;
  font-size: 1.4rem; font-weight: 700;
  border-radius: 999px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

/* ---- Admin: OBS overlay links ---- */
.ov-links { margin-top: 0.5rem; }
.ov-links summary {
  cursor: pointer;
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
}
.ov-links a { display: inline-block; margin: 0.4rem 0.6rem 0 0; font-size: 0.88rem; }
.ov-links p { margin: 0.5rem 0 0; font-size: 0.8rem; }
.ov-links code { background: var(--ink-3); border: 1px solid var(--line); border-radius: 3px; padding: 0 0.3em; }

/* ---- Home: tournament cards align their footer (date + players) ---- */
.tcard { display: flex; flex-direction: column; }
.tcard > p { margin: 0.25rem 0 0; }
.tcard > p:first-of-type { margin-top: auto; } /* empurra data + stats para o rodapé */

/* ---- Players: organizers (admins) highlighted ---- */
.admin-card { border-color: var(--gold-deep); }
.admin-card::before { opacity: 1; } /* gold frame-rule fully lit */
.admin-card:hover { border-color: var(--gold); }

/* ---- Collapsible sections (tournament page) ---- */
details.sect { margin-top: 2rem; }
details.sect > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0 0 0.75rem;
  font-family: 'Cinzel', serif;
  font-weight: 600;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--gold);
}
details.sect > summary::-webkit-details-marker { display: none; }
details.sect > summary::before {
  content: "";
  width: 8px; height: 8px;
  flex: 0 0 auto;
  background: var(--gold);
  transform: rotate(45deg);
  box-shadow: 0 0 10px rgba(201,162,90,0.5);
}
details.sect > summary::after {
  content: "\25B8"; /* ▸ */
  margin-left: auto;
  color: var(--bone-dim);
  transition: transform 0.15s ease;
}
details.sect[open] > summary::after { transform: rotate(90deg); }
details.sect > summary:hover { color: var(--gold-bright); }

/* Grupos de torneio no histórico de partidas (player.php): data · título · recorde,
   com separadores verticais entre eles. O chevron fica à direita. */
.mh-group > summary .mh-date {
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  white-space: nowrap;
}
.mh-group > summary .mh-name { text-transform: none; letter-spacing: 0.03em; }
.mh-group > summary .mh-sep {
  width: 1px;
  align-self: stretch;
  min-height: 1em;
  background: currentColor;
  opacity: 0.28;
}
.mh-group > summary .record { text-transform: none; letter-spacing: normal; }

/* ============================================================
   Leagues — "The Season Ledger"
   A league is the longer arc: a season-long points race across
   many tournaments. Where a tournament page reads as one battle,
   the league reads as a campaign — a measured ladder + a timeline.
   ============================================================ */

/* ---- Season header: span of dates + standing of the season ---- */
.season-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.9rem;
  margin: 0 0 0.9rem;
}
.season-span {
  font-family: 'Cinzel', serif;
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  color: var(--bone-dim);
}
.season-span .to { color: var(--gold-deep); margin: 0 0.25rem; }
.badge.season   { background: rgba(201,162,90,0.16); color: var(--gold-bright); border-color: var(--gold-deep); }
.badge.season::before {
  content: "";
  display: inline-block;
  width: 0.5em; height: 0.5em;
  margin-right: 0.45em;
  background: var(--gold-bright);
  transform: rotate(45deg);   /* heraldic lozenge, not a dot — this is structure, not "live" */
  vertical-align: middle;
}
.badge.upcoming { background: var(--ink-3); color: var(--bone-dim); border-color: var(--line); }
.league-desc { max-width: 60ch; color: var(--bone); margin: 0 0 0.4rem; }

/* ---- The law of the league: scoring key ---- */
.score-key {
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  margin: 1.2rem 0 0;
  background: var(--line-soft);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
.score-key .k {
  flex: 1 1 84px;
  padding: 0.7rem 0.9rem 0.65rem;
  background: var(--ink-2);
  text-align: center;
}
.score-key .k .v {
  font-family: 'Cinzel', serif;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
  color: var(--gold-bright);
}
.score-key .k .v.zero { color: var(--bone-dim); }
.score-key .k .t {
  display: block;
  margin-top: 0.4rem;
  font-family: 'Cinzel', serif;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--bone-dim);
}

/* ---- The standings ladder (signature) ----
   Each rung carries a gold "ground gained" bar scaled to the leader's
   points: the size of the lead becomes visible, not just a number. */
.ladder { display: flex; flex-direction: column; }
.ladder-row {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0.15rem 1rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--line-soft);
}
.ladder-row:first-child { border-top: none; }
.ladder .rank {
  font-family: 'Cinzel', serif;
  font-size: 1.05rem;
  font-weight: 700;
  text-align: right;
  color: var(--bone-dim);
  font-variant-numeric: tabular-nums;
}
.ladder-row.podium .rank { color: var(--gold); }
.ladder-row.lead   .rank { color: var(--gold-bright); }
.ladder .who { min-width: 0; }
.ladder .name {
  font-family: 'Cinzel', serif;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: var(--bone);
}
.ladder-row.lead .name { color: var(--gold-bright); }
.ladder .name:hover { color: var(--gold-bright); text-decoration: none; }
/* Leader wears the heraldic lozenge — the same mark the section headers use. */
.ladder-row.lead .name::before {
  content: "";
  display: inline-block;
  width: 0.5em; height: 0.5em;
  margin-right: 0.5em;
  background: var(--gold);
  transform: rotate(45deg);
  box-shadow: 0 0 10px rgba(201,162,90,0.5);
  vertical-align: middle;
}
.ladder .ev {
  margin-top: 0.1rem;
  font-size: 0.78rem;
  color: var(--bone-dim);
}
.ladder .pts {
  text-align: right;
  white-space: nowrap;
  font-family: 'Cinzel', serif;
}
.ladder .pts b {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gold-bright);
  font-variant-numeric: tabular-nums;
}
.ladder .pts .unit {
  margin-left: 0.25rem;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--bone-dim);
}
.ladder .pts .behind {
  display: block;
  margin-top: 0.15rem;
  font-family: 'Spectral', Georgia, serif;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  color: var(--bone-dim);
}
.ladder-row.lead .pts .behind { color: var(--gold); }
.ladder .gain {
  grid-column: 2 / -1;       /* the rung spans beneath name + points */
  margin-top: 0.5rem;
  height: 6px;
  border-radius: 999px;
  background: var(--ink-3);
  border: 1px solid var(--line-soft);
  overflow: hidden;
}
.ladder .gain > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold));
}
.ladder-row.lead .gain > span {
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
}

/* ---- The season trail: tournaments as a chronological timeline ----
   Order is information here, so this is a line, not a table. Lozenge
   nodes echo the leader mark; the rule fades as the season recedes. */
.timeline {
  position: relative;
  margin: 0;
  padding: 0.2rem 0 0 1.5rem;
  list-style: none;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 0.31rem; top: 0.5rem; bottom: 0.5rem;
  width: 2px;
  background: linear-gradient(180deg, var(--gold), var(--gold-deep) 45%, var(--line));
}
.tl-item { position: relative; padding: 0 0 1.25rem; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: "";
  position: absolute;
  left: -1.5rem; top: 0.3rem;
  width: 0.66rem; height: 0.66rem;
  background: var(--gold);
  transform: rotate(45deg);
  box-shadow: 0 0 0 3px var(--ink-2);   /* punches a clean gap in the rule */
}
.tl-date {
  font-family: 'Cinzel', serif;
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--gold);
}
.tl-name { margin: 0.15rem 0 0.1rem; font-size: 1.05rem; }
.tl-meta { margin: 0; color: var(--bone-dim); font-size: 0.85rem; }

/* ---- Leagues index: season cards ---- */
.lcard { display: flex; flex-direction: column; }
.lcard .lcard-foot {
  margin-top: auto;
  padding-top: 0.6rem;
  color: var(--bone-dim);
  font-size: 0.88rem;
}
.lcard .season-span { margin-top: 0.15rem; }

/* ---- Wiki description: shared by the editor and the public render, so the
   admin sees exactly what visitors will see (WYSIWYG). ---- */
.wiki { color: var(--bone); line-height: 1.7; }
.wiki > :first-child { margin-top: 0; }
.wiki > :last-child { margin-bottom: 0; }
.wiki h1, .wiki h2, .wiki h3 {
  display: block;                 /* cancel the global section-header flex layout */
  font-family: 'Cinzel', serif;
  text-transform: none;
  letter-spacing: 0.02em;
  color: var(--gold-bright);
  margin: 1.3rem 0 0.5rem;
}
.wiki h2::before, .wiki h2::after { content: none; }   /* no lozenge / trailing rule here */
.wiki h1 { font-size: 1.5rem; }
.wiki h2 { font-size: 1.2rem; }
.wiki h3 { font-size: 1.02rem; }
.wiki p { margin: 0 0 0.8rem; }
.wiki ul, .wiki ol { margin: 0 0 0.8rem; padding-left: 1.5rem; }
.wiki li { margin: 0.2rem 0; }
.wiki strong, .wiki b { font-weight: 700; color: var(--bone); }
.wiki a { color: var(--gold-bright); text-decoration: underline; text-underline-offset: 2px; }
.wiki blockquote {
  margin: 0 0 0.8rem;
  padding: 0.3rem 0 0.3rem 1rem;
  border-left: 3px solid var(--gold-deep);
  color: var(--bone-dim);
  font-style: italic;
}
.wiki code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 0.3em;
}
.wiki pre {
  background: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 0.8rem 1rem;
  overflow-x: auto;
}
.wiki pre code { background: none; border: none; padding: 0; }
.wiki hr { border: none; border-top: 1px solid var(--line); margin: 1.2rem 0; }

/* ---- Rich-text editor chrome (admin) ---- */
.rt-field { margin-top: 0.3rem; }
.rt-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  padding: 0.4rem;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: var(--r) var(--r) 0 0;
}
.rt-btn {
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: var(--ink-3);
  color: var(--bone-dim);
  border: 1px solid var(--line);
  border-radius: 3px;
  font-family: 'Cinzel', serif;
  font-size: 0.82rem;
  line-height: 1;
}
.rt-btn:hover { color: var(--gold-bright); border-color: var(--gold-deep); }
.rt-sep { align-self: stretch; width: 1px; margin: 0.15rem 0.2rem; background: var(--line); }
.rt-editor {
  min-height: 170px;
  max-height: 460px;
  overflow-y: auto;
  padding: 0.85rem 1rem;
  background: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: 0 0 var(--r) var(--r);
  outline: none;
  font-family: 'Spectral', Georgia, serif;
  font-size: 0.98rem;
}
.rt-editor:focus { border-color: var(--gold); box-shadow: inset 0 0 0 1px rgba(201,162,90,0.35); }
.rt-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--bone-dim);
  font-style: italic;
  pointer-events: none;
}

/* ---- League admin form: name + description get real room ---- */
.league-form { margin-bottom: 0.6rem; }
.league-form .row { margin-top: 0.1rem; }
.league-form input.lg {
  font-family: 'Cinzel', serif;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  padding: 0.6rem 0.8rem;
}

@media (max-width: 640px) {
  .ladder .pts b { font-size: 1.2rem; }
  .ladder .name, .ladder .rank { font-size: 0.98rem; }
}

/* ---- Player profile: win-rate mini bar (hero usage / by-format tables) ---- */
.winbar {
  display: inline-block;
  vertical-align: middle;
  width: 90px;
  max-width: 38vw;
  height: 6px;
  margin-right: 0.5rem;
  border-radius: 999px;
  background: var(--ink-3);
  border: 1px solid var(--line-soft);
  overflow: hidden;
}
.winbar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold));
}
.res-tag.loss { color: var(--blood-bright); }

/* ---- A11y & motion ---- */
:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }

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

/* ---- Responsive: tablet ---- */
@media (max-width: 900px) {
  .topbar { gap: 0.9rem 1.2rem; padding: 0.6rem 1rem; }
  .topbar nav { gap: 0.9rem 1.2rem; order: 3; flex-basis: 100%; }
}

/* ---- Responsive: collapse nav into a hamburger when it stops fitting ---- */
@media (max-width: 760px) {
  .nav-toggle { display: inline-flex; }
  .topbar { gap: 0.6rem 1rem; }

  /* Nav and account are hidden until the menu is opened, then stack full-width.
     Order them links-first, account-last (overrides the order:3 from the 900px rule). */
  .topbar #site-nav,
  .topbar .account {
    display: none;
    flex-basis: 100%;
    width: 100%;
    margin-left: 0;
  }
  .topbar #site-nav { order: 2; }
  .topbar .account { order: 3; }
  .topbar.nav-open #site-nav {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding-top: 0.3rem;
    border-top: 1px solid var(--line-soft);
  }
  .topbar.nav-open #site-nav a {
    padding: 0.7rem 0.2rem;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--line-soft);
  }
  .topbar.nav-open #site-nav a:last-child { border-bottom: none; }
  .topbar.nav-open .account {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    margin-top: 0.6rem;
    padding-top: 0.7rem;
    border-top: 1px solid var(--line-soft);
  }
  .topbar.nav-open .account .who { padding: 0.2rem 0; max-width: none; }
  .topbar.nav-open .account .btn { text-align: center; }
}

/* ---- Responsive: wide tables fold into stacked rows on phones (no side-scroll) ---- */
@media (max-width: 640px) {
  .table-cards thead { display: none; }
  .table-cards,
  .table-cards tbody,
  .table-cards tr,
  .table-cards td { display: block; width: 100%; }
  .table-cards tr {
    border-top: 1px solid var(--line);
    padding: 0.7rem 0 0.5rem;
  }
  .table-cards tbody tr:first-child { border-top: none; }
  .table-cards tbody tr:hover { background: transparent; }
  .table-cards td {
    border: none;
    padding: 0.22rem 0;
  }
  .table-cards td::before {
    content: attr(data-label);
    display: inline-block;
    min-width: 7em;
    font-family: 'Cinzel', serif;
    font-size: 0.62rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--bone-dim);
    vertical-align: baseline;
  }
  .table-cards td[data-label="Player"] { font-size: 1.05rem; }
  /* Marketplace em lista: a miniatura e o estado vazio não têm rótulo a exibir,
     e as ações precisam poder quebrar em telas estreitas. */
  .listing-table td.lt-thumb::before,
  .listing-table .listing-empty-row td::before { display: none; }
  .listing-table td[data-label="Card"] { font-size: 1.05rem; }
  .listing-table .lt-actions { white-space: normal; }
  .listing-table .lt-actions .row { flex-wrap: wrap; }
  .listing-table .card-thumb { width: 52px; height: 72px; }
  /* Coluna só de botão não tem rótulo — sem isto sobra a indentação vazia */
  .wantlist-table td:not([data-label])::before { display: none; }
  /* Idem para quem declara data-label="" explicitamente: o ::before ficaria sem
     texto mas ainda ocupando o min-width de 7em do rótulo. */
  .table-cards td[data-label=""]::before { display: none; }
  .table-cards td.trail-cell { padding-top: 0.5rem; }
  .table-cards td.trail-cell::before { display: block; min-width: 0; margin-bottom: 0.4rem; }
  .table-cards .trail { flex-wrap: wrap; }
  .bye-row td[data-label="Player 2"] { color: var(--bone-dim); font-style: italic; }

  /* A tabela do marketplace em lista é .set-table E .table-cards: as linhas já
     viraram blocos aqui, mas o min-width:560px de .set-table continuava valendo
     e sobrava como rolagem lateral vazia dentro do .table-scroll.
     As outras .set-table (bulk_set, bulk_csv) não dobram e seguem rolando. */
  .table-cards.set-table { min-width: 0; }
}

/* ---- Responsive: phone ---- */
@media (max-width: 640px) {
  .content { padding: 1.5rem 1rem 3rem; }

  /* Stack form fields full-width (overrides inline flex:1/flex:2 on .field);
     button-only and title rows have no .field, so they stay inline. */
  .row > .field { flex: 1 1 100% !important; }

  /* 16px inputs stop iOS from zooming the page on focus. */
  input, select, textarea { font-size: 16px; }

  /* Roomier tap targets for the many small action buttons. */
  .btn { padding: 0.6rem 1.1rem; }
  .btn.sm { padding: 0.45rem 0.8rem; font-size: 0.72rem; }

  /* Brand and account stay on one tidy line; trim a long username. */
  .topbar { gap: 0.6rem 1rem; }
  .topbar .brand img { height: 32px; }
  .topbar .who { max-width: 38vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* Two card tiles per row keeps the qty badge legible on a phone. */
  .res-gallery { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1rem; }
  .qty-badge { font-size: 1.25rem; min-width: 2.2rem; height: 2.2rem; }
  .reservation-summary { font-size: 1.05rem; }
  .big-num { font-size: 1.5rem; }
  .hero h1 { font-size: 2rem; }
}

/* ---- Responsive: alvos de toque ----
   Vale por ponteiro, não por largura: um tablet largo continua sendo dedo. A
   referência é ~44px; os botões pequenos ficavam em 25-33px, e os números da
   paginação eram os piores por ficarem colados um no outro.
   min-height + inline-flex em vez de mais padding: assim o botão cresce até o
   alvo sem esticar o texto nem quebrar as linhas de ações. */
@media (pointer: coarse) {
  .btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .btn.sm {
    min-height: 40px;          /* aparecem várias por linha; 40 mantém a linha inteira */
    padding: 0.45rem 0.9rem;
  }
  .pagination { gap: 0.5rem; }
  .pagination .btn.sm { min-width: 44px; }
  .filter-chip { min-height: 36px; padding: 0.4rem 0.7rem; }
  .card-result { padding-top: 0.6rem; padding-bottom: 0.6rem; }
}

/* ── YouTube embed + watch mode ─────────────────────────────────────────── */
.watch-toggle { vertical-align: middle; margin-left: 0.5rem; }

/* Admin: compact per-tournament video link form. */
.yt-form { display: flex; gap: 0.4rem; align-items: center; margin: 0.5rem 0; }
.yt-form input[type="url"] { flex: 1 1 auto; min-width: 0; max-width: 320px; }

/* Responsive 16:9 video frame (matches the card styling). */
.tourney-video {
  position: relative;
  width: 100%;
  max-width: 860px;      /* limited & centered in normal view */
  margin: 0 auto 1.25rem;
  padding-top: 56.25%;   /* 16:9 */
  height: 0;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.tourney-video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Watch mode: a large, immersive video with standings/rounds in a slim side rail.
   The grid breaks out of the 1040px content column so the video can go wide. */
.watch-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;   /* video takes the room, data in a rail */
  gap: 1.5rem;
  align-items: start;
  width: min(1560px, 94vw);
  margin-left: calc(-1 * (min(1560px, 94vw) - 100%) / 2);  /* center the wider box */
}
.watch-grid .watch-video { position: sticky; top: 1rem; }
.watch-grid .tourney-video { max-width: none; margin: 0; }  /* fill the (large) column */
.watch-grid .watch-main { min-width: 0; }
.watch-grid .watch-main details.sect { margin-top: 0; }
.watch-grid .watch-main #live-zone { display: flex; flex-direction: column; gap: 1.5rem; }

/* Segmented switch: show one of Rounds / Standings at a time in the rail. */
.watch-switch { display: flex; gap: 0.35rem; margin-bottom: 1rem; }
.watch-switch button {
  flex: 1;
  padding: 0.5rem 0.6rem;
  font: 600 0.72rem/1 'Cinzel', serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bone-dim);
  background: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
}
.watch-switch button:hover { color: var(--gold-bright); }
.watch-switch button[aria-selected="true"] {
  color: var(--ink);
  background: var(--gold);
  border-color: var(--gold-deep);
}
.watch-main.watch-show-rounds .sect-standings,
.watch-main.watch-show-standings .sect-rounds { display: none; }

/* ── Leaner standings + rounds for the narrow watch rail (no side-scroll) ── */
/* Standings: drop the wide Record + Campaign-trail columns; keep #, player, hero, score. */
.watch-grid .sect-standings thead th:nth-child(n+5),
.watch-grid .sect-standings td[data-label="Record"],
.watch-grid .sect-standings td.trail-cell,
.watch-grid .sect-standings .trail-legend,
.watch-grid .sect-standings .predicted-note { display: none; }
.watch-grid .sect-standings table { font-size: 0.85rem; }
.watch-grid .sect-standings th,
.watch-grid .sect-standings td { padding: 0.35rem 0.5rem; }
.watch-grid .sect-standings td[data-label="Hero"] { font-size: 0; }          /* keep portrait, drop name */
.watch-grid .sect-standings td[data-label="Player"] { max-width: 150px; }
.watch-grid .sect-standings td[data-label="Player"] a {
  display: inline-block; max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom;
}

/* Rounds: stack each match into a compact card instead of a 4-column table. */
.watch-grid .sect-rounds .table-cards thead { display: none; }
.watch-grid .sect-rounds .table-cards,
.watch-grid .sect-rounds .table-cards tbody,
.watch-grid .sect-rounds .table-cards tr,
.watch-grid .sect-rounds .table-cards td { display: block; width: 100%; }
.watch-grid .sect-rounds .table-cards tr { padding: 0.5rem 0; border-top: 1px solid var(--line-soft); }
.watch-grid .sect-rounds .table-cards tbody tr:first-child { border-top: 0; }
.watch-grid .sect-rounds .table-cards td { padding: 0.1rem 0; border: 0; }
.watch-grid .sect-rounds .table-cards td[data-label="Table"] {
  font-size: 0.68rem; color: var(--bone-dim); text-transform: uppercase; letter-spacing: 0.08em;
}
.watch-grid .sect-rounds .table-cards td[data-label="Table"]::before { content: "Table "; }
.watch-grid .sect-rounds .table-cards td[data-label="Result"] { margin-top: 0.15rem; }

@media (max-width: 1100px) {
  .watch-grid { grid-template-columns: minmax(0, 1fr) 300px; }
}
@media (max-width: 900px) {
  .watch-grid {                                    /* stack: video first, full width */
    grid-template-columns: 1fr;
    width: auto;
    margin-left: 0;
  }
  .watch-grid .watch-video { position: static; }
}
