:root {
  color-scheme: dark;
  font: 16px/1.55 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #eceef1;
  background: #101113;
  --bg: #101113;
  --surface: #17191c;
  --surface-2: #1d2024;
  --muted: #9aa1ab;
  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .15);
  --accent: #d5dae1;
  --radius: 16px;
  --display: "Space Grotesk", "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
a { color: var(--accent); text-underline-offset: .2em; transition: color .15s; }
a:hover { color: #fff; }
:focus-visible { outline: 2px solid #fff; outline-offset: 3px; border-radius: 6px; }
.wrap { width: min(1240px, calc(100% - 40px)); margin-inline: auto; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(36px, 7vw, 84px) 0 34px;
  background:
    radial-gradient(640px 320px at 90% -20%, rgba(255, 255, 255, .09), transparent 70%),
    linear-gradient(170deg, #202327, #121315 75%);
  border-bottom: 1px solid var(--line);
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 14px);
  mask-image: linear-gradient(to bottom, #000, transparent 90%);
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent 90%);
  pointer-events: none;
}
.hero .wrap { position: relative; }
.hero-heading { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 22px 32px; margin-bottom: 30px; }
.handle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 11px;
  font-size: .88rem;
  font-weight: 600;
  text-decoration: none;
  color: #dfe3e8;
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  transition: background .2s, border-color .2s;
}
.handle::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #ffb547; box-shadow: 0 0 10px 1px rgba(255, 181, 71, .7); }
.handle:hover { background: rgba(255, 255, 255, .11); border-color: rgba(255, 255, 255, .28); }
h1 {
  font-family: var(--display);
  font-size: clamp(2.8rem, 8.5vw, 5.6rem);
  line-height: 1.02;
  letter-spacing: -.055em;
  margin-top: .22em;
  background: linear-gradient(180deg, #fff 30%, #8d949e 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.summary { display: grid; grid-template-columns: 1fr 2fr; gap: 14px; }
.metric {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 20px;
  background: linear-gradient(160deg, rgba(255, 255, 255, .065), rgba(255, 255, 255, .02));
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}
.metric span { order: -1; color: var(--muted); font-size: .72rem; font-weight: 650; letter-spacing: .09em; text-transform: uppercase; }
.metric strong { font-family: var(--display); color: #fff; font-size: clamp(1.5rem, 3.6vw, 2.1rem); line-height: 1.15; letter-spacing: -.02em; overflow-wrap: anywhere; }

/* ---------- Sync ---------- */
button, input, select { font: inherit; }
button { cursor: pointer; }
.sync { display: grid; gap: 9px; justify-items: start; max-width: 30rem; }
.sync p { color: var(--muted); font-size: .86rem; }
.sync button {
  color: #15171a;
  background: linear-gradient(180deg, #f2f4f6, #c9ced5);
  border: 0;
  border-radius: 11px;
  font-weight: 700;
  padding: 12px 22px;
  box-shadow: 0 6px 18px -8px rgba(0, 0, 0, .9), inset 0 1px 0 #fff;
  transition: transform .15s, filter .15s;
}
.sync button:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.06); }
.sync button:active:not(:disabled) { transform: none; }
.sync button:disabled { opacity: .6; cursor: wait; }
.sync p:empty { display: none; }

/* ---------- Coleção ---------- */
main { padding: 36px 0 70px; }
.collection-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 20px; margin-bottom: 18px; }
.collection-heading h2 { font-family: var(--display); font-size: 1.9rem; letter-spacing: -.035em; }
.method { color: var(--muted); font-size: .88rem; }
.method[open] { flex-basis: 100%; padding: 14px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.method summary { color: var(--accent); cursor: pointer; width: fit-content; }
.method p { margin-top: 10px; max-width: 85ch; }

.controls {
  position: sticky;
  top: 10px;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  padding: 14px;
  background: rgba(23, 25, 28, .82);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  box-shadow: 0 16px 40px -20px #000;
}
.metric.metric--rarest {
  flex-direction: row;
  align-items: center;
  gap: 14px;
}
.metric--rarest > .icon { order: 0; flex-shrink: 0; }
.metric--rarest > .icon[hidden] { display: none; }
.metric--rarest > div {
  display: grid;
  min-width: 0;
  gap: 5px;
}
.metric--rarest #rarest-caption {
  order: 0;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.filter-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 45px;
  padding: 8px 15px;
  background: #0f1012;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: #eceef1;
  cursor: pointer;
}
.filter-icon {
  width: 17px;
  height: 17px;
  flex: none;
  background: currentColor;
  clip-path: polygon(0 8%, 100% 8%, 62% 54%, 62% 85%, 38% 100%, 38% 54%);
}
.filter-toggle:hover, .filter-toggle[aria-expanded="true"] { background: #292c31; }
.filter-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: min(100%, 510px);
  max-height: min(55vh, 350px);
  overflow-y: auto;
  padding: 14px;
  background: #17191c;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: 0 16px 36px rgba(0, 0, 0, .55);
}
.filter-panel[hidden] { display: none; }
.controls label { min-width: 0; display: grid; gap: 6px; font-size: .72rem; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.controls input, .controls select {
  min-width: 0;
  width: 100%;
  min-height: 45px;
  padding: 9px 12px;
  color: #eceef1;
  font-size: .95rem;
  font-weight: 450;
  letter-spacing: 0;
  text-transform: none;
  background-color: #0f1012;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
}
.controls select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%239aa1ab' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.controls input:hover, .controls select:hover { border-color: rgba(255, 255, 255, .28); }
.controls input:focus, .controls select:focus { outline: 0; border-color: #d5dae1; box-shadow: 0 0 0 3px rgba(213, 218, 225, .18); }
.controls input::placeholder { color: #6f7680; }
.controls option { background: #17191c; color: #eceef1; }
.results { min-height: 54px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: .88rem; }
.results button { padding: 5px 12px; border: 1px solid var(--line-strong); border-radius: 999px; background: transparent; color: var(--accent); transition: background .15s; }
.results button:hover { background: rgba(255, 255, 255, .08); }

/* ---------- Cards ----------
   Escala de raridade: do aço (comum) ao âmbar (extremo),
   esfriando → esquentando conforme o badge fica mais raro. */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: 16px; }
.card {
  --tone: #8a919b;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--tone) 50%, transparent);
  box-shadow: 0 16px 36px -18px color-mix(in srgb, var(--tone) 50%, transparent), 0 4px 12px rgba(0, 0, 0, .35);
}
.card[data-rarity="very-common"] { --tone: #8a919b; } /* aço */
.card[data-rarity="common"]      { --tone: #7fae95; } /* sálvia */
.card[data-rarity="uncommon"]    { --tone: #55b6c9; } /* turquesa */
.card[data-rarity="rare"]        { --tone: #6c8dff; } /* azul */
.card[data-rarity="very-rare"]   { --tone: #b47cff; } /* ametista */
.card[data-rarity="extreme"]     { --tone: #ffb547; } /* âmbar */
.card[data-rarity="unknown"]     { --tone: #5d636c; }
.card[data-rarity="extreme"] { border-color: color-mix(in srgb, var(--tone) 38%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--tone) 12%, transparent), 0 14px 34px -22px color-mix(in srgb, var(--tone) 70%, transparent); }

.card-head { display: flex; align-items: center; gap: 14px; }
.card h3 { font-family: var(--display); font-size: 1.05rem; line-height: 1.25; letter-spacing: -.01em; overflow-wrap: anywhere; }
.event { margin-top: 3px; color: var(--muted); font-size: .8rem; line-height: 1.35; overflow-wrap: anywhere; }
.icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  flex: none;
  border-radius: 15px;
  color: var(--tone);
  background: radial-gradient(circle at 50% 30%, #2c3035, #1a1c20 80%);
  border: 1px solid var(--line-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
}
.icon img { width: 40px; height: 40px; object-fit: contain; filter: drop-shadow(0 3px 5px rgba(0, 0, 0, .5)); transition: transform .25s; }
.card:hover .icon img { transform: scale(1.1) rotate(-4deg); }

/* Painel de raridade */
.rarity {
  display: grid;
  gap: 9px;
  padding: 12px 14px 11px;
  background: color-mix(in srgb, var(--tone) 9%, #121316);
  border: 1px solid color-mix(in srgb, var(--tone) 26%, transparent);
  border-left: 3px solid var(--tone);
  border-radius: 12px;
}
.rarity-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.rarity-label { color: var(--tone); font-size: .72rem; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
.rarity-pct { font-family: var(--display); font-size: 1.35rem; line-height: 1; letter-spacing: -.02em; color: #fff; font-variant-numeric: tabular-nums; }
.track { position: relative; height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.track .fill { position: absolute; inset: 0 auto 0 0; border-radius: 6px; background: linear-gradient(90deg, color-mix(in srgb, var(--tone) 45%, transparent), var(--tone)); }
.track i { position: absolute; top: 0; bottom: 0; width: 2px; background: #121316; }
.rarity-note { color: var(--muted); font-size: .74rem; line-height: 1.35; }

.card dl { display: grid; gap: 12px; margin: 0; }
.card dt { color: var(--muted); font-size: .68rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; }
.card dd { margin: 2px 0 0; font-size: .9rem; color: #dfe3e8; overflow-wrap: anywhere; }
.card footer { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); font-size: .8rem; }
.card footer a { padding: 4px 11px; text-decoration: none; border: 1px solid var(--line-strong); border-radius: 999px; transition: background .15s, border-color .15s; }
.card footer a:hover { background: rgba(255, 255, 255, .07); border-color: color-mix(in srgb, var(--tone) 60%, transparent); }

@media (max-width: 820px) {
  .controls { position: relative; }
}
@media (max-width: 540px) {
  .wrap { width: calc(100% - 28px); }
  .summary { grid-template-columns: 1fr; }
  .filter-panel { grid-template-columns: 1fr; }
  .filter-toggle { padding-inline: 10px; }
  .hero-heading { margin-bottom: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before { transition: none !important; }
  .card:hover { transform: none; }
}

/* ---------- Agenda ---------- */
.agenda-atalho {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  font-weight: 650;
  text-decoration: none;
}

.agenda-controles { display: grid; gap: 14px; margin-bottom: 22px; }
.agenda-filtros { display: flex; flex-wrap: wrap; gap: 8px; }
.agenda-filtros a {
  padding: 7px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  text-decoration: none;
}
.agenda-filtros [aria-current="page"] { background: #eceef1; color: #17191c; font-weight: 650; }
.agenda-fonte, .agenda-campanha, .agenda-detalhes dt { color: var(--muted); font-size: .875rem; }
.agenda-card, .agenda-vazia {
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}
.agenda-card { display: flex; min-width: 0; flex-direction: column; align-items: flex-start; gap: 12px; }
.agenda-card-topo { display: flex; align-items: center; gap: 10px; min-width: 0; }
.agenda-card-topo img { flex: none; object-fit: contain; }
.agenda-card h2 { font: 700 1.3rem/1.2 var(--display); overflow-wrap: anywhere; }
.agenda-custo {
  padding: 3px 10px;
  border: 1px solid currentColor;
  border-radius: 999px;
  color: var(--accent);
  font-size: .8rem;
  font-weight: 700;
}
.agenda-custo--gratis { color: #a3e6b9; background: #183224; }
.agenda-custo--sub-ou-gift, .agenda-custo--gift, .agenda-custo--sub {
  color: #dfc9ff;
  background: #342348;
}
.agenda-detalhes { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0; }
.agenda-detalhes dd { margin: 0; }
.agenda-categoria { flex-basis: 100%; }
.agenda-link { margin-top: auto; padding-top: 4px; font-size: .875rem; }
