/* Database (/db/). Usa os tokens e componentes do rt.css; prefixo rt-db. */

.rt-db-topo { display: grid; gap: 14px; margin: 0 auto 18px; position: relative; z-index: 2; }
.rt-db-migalhas ol { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; list-style: none; font-weight: 800; font-size: 14px; color: var(--rt-texto-suave); }
.rt-db-migalhas li + li::before { content: "›"; margin-right: 4px; opacity: .6; }
.rt-db-migalhas a { color: #874e2e; text-decoration: none; }
.rt-db-migalhas a:hover { text-decoration: underline; }
.rt-db-migalhas [aria-current] { color: var(--rt-texto); }

.rt-db-busca { position: relative; display: flex; gap: 10px; }
.rt-db-busca__campo { flex: 1; min-width: 0; font-size: 17px; }
.rt-db-busca__botao { flex: none; }
.rt-db-sugestoes { position: absolute; z-index: 50; left: 0; right: 0; top: calc(100% + 6px); max-height: min(60vh, 440px); overflow: auto; margin: 0; padding: 6px; list-style: none;
  background: #fffaf0; border: 2px solid var(--rt-papel-borda); border-radius: 14px; box-shadow: var(--rt-sombra-cartao); }
.rt-db-sugestao { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; color: var(--rt-texto); text-decoration: none; font-weight: 800; }
.rt-db-sugestao img { max-width: 32px; max-height: 32px; justify-self: center; image-rendering: pixelated; }
.rt-db-sugestao__sem { width: 24px; height: 24px; justify-self: center; border-radius: 6px; background: #f3e7d8; }
.rt-db-sugestao small { color: var(--rt-texto-suave); font-weight: 700; text-align: right; }
.rt-db-sugestoes [aria-selected="true"] .rt-db-sugestao, .rt-db-sugestao:hover { background: #fde9b8; }

/* a tira de abas centralizada, do tamanho das abas (o margin: 0 de antes a
   prendia à esquerda, com 860 px de largura) */
.rt-db-abas.rt-abas--tira { width: fit-content; max-width: 100%; margin: 0 auto; }
.rt-db-abas .rt-abas__lista { flex-wrap: wrap; }

/* fichas */
.rt-db-ficha { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; margin: 0 auto; }
.rt-db-ficha > *, .rt-db-cabeca > *, .rt-quadro__papel { min-width: 0; }
.rt-db-ficha > .rt-quadro { margin: 0; }
/* a placa sai 36 px (30 no celular) acima do quadro: no grid a margem não
   colapsa, então ela soma ao gap (22) ou à margem da tira (18) e sobra folga */
.rt-db-ficha > .rt-quadro--com-placa { margin-top: 40px; }
.rt-db-cabeca { display: grid; grid-template-columns: minmax(120px, 220px) minmax(0, 1fr); gap: 22px; align-items: start; }
.rt-db-cabeca--carta { grid-template-columns: minmax(160px, 284px) minmax(0, 1fr); }
.rt-db-arte { display: grid; place-items: center; gap: 8px; margin: 0; min-height: 140px; padding: 14px; border-radius: var(--rt-raio);
  background: radial-gradient(circle at 50% 35%, #fff7d6, #f3dfb2); box-shadow: inset 0 0 0 2px #ecd29c; }
.rt-db-arte img { max-width: 100%; height: auto; }
.rt-db-arte--carta { padding: 8px; background: none; box-shadow: none; }
.rt-db-arte--carta img { border-radius: 10px; box-shadow: var(--rt-sombra-cartao); }
.rt-db-arte--mapa { padding: 6px; }
.rt-db-arte--mapa img { border-radius: 8px; image-rendering: auto; }
.rt-db-arte figcaption { font-size: 12px; color: var(--rt-texto-suave); text-align: center; }
.rt-db-pixel, .rt-db-arte--mob img, .rt-db-arte:not(.rt-db-arte--carta):not(.rt-db-arte--mapa):not(.rt-db-arte--hab) img { image-rendering: pixelated; }
.rt-db-nome { margin: 0; font-family: var(--rt-fonte-titulo); font-weight: 400; font-size: clamp(26px, 4vw, 36px); line-height: 1.1; color: var(--rt-madeira-escura); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rt-db-nome img { image-rendering: pixelated; }
.rt-db-original { margin: 4px 0 12px; color: var(--rt-texto-suave); font-weight: 700; }
.rt-db-original code, .rt-db-tabela code { font-size: .92em; background: #f3e7d8; padding: 0 5px; border-radius: 5px; }
.rt-db-fatos { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.rt-db-classes, .rt-db-troca { margin: 12px 0 0; }
.rt-db-sub { margin: 22px 0 10px; font-family: var(--rt-fonte-titulo); font-weight: 400; font-size: 21px; color: var(--rt-madeira); }
.rt-db-sub small { font-family: var(--rt-fonte); font-size: 13px; font-weight: 700; color: var(--rt-texto-suave); }
.rt-db-explica { margin: 0 0 12px; color: var(--rt-texto-suave); font-weight: 600; }
.rt-db-suave { color: var(--rt-texto-suave); font-weight: 600; }
.rt-db-num { text-align: right; white-space: nowrap; }
.rt-db-chance { color: var(--rt-vermelho-escuro); }
.rt-db-mvp { background: var(--rt-vermelho); color: #fff; }

/* descrição do cliente */
.rt-db-desc { padding: 14px 16px; border-radius: 12px; background: #fffdf6; box-shadow: inset 0 0 0 2px #efe0c0; font-weight: 600; }
.rt-db-desc p { margin: 0 0 4px; }
.rt-db-desc__sep { border: 0; border-top: 1px dashed #dcc69a; margin: 8px 0; }
.rt-db-cor--azul { color: #1f4fbf; }
.rt-db-cor--vermelho { color: #b3261e; }
.rt-db-cor--verde { color: #23803a; }
.rt-db-cor--cinza { color: #7a6a5c; }
.rt-db-cor--laranja { color: #b95e00; }
.rt-db-cor--roxo { color: #7a2ea6; }
.rt-db-cor--ciano { color: #11797c; }
.rt-db-cor--amarelo { color: #8f6d00; }

.rt-db-script { margin-top: 16px; }
.rt-db-script summary { cursor: pointer; font-weight: 800; color: var(--rt-madeira); }
.rt-db-script pre { margin: 6px 0 10px; padding: 12px 14px; overflow-x: auto; border-radius: 10px; background: #2b211b; color: #f6e7c8; font-size: 13px; line-height: 1.5; }
.rt-db-script__rot { margin: 10px 0 0; font-weight: 800; font-size: 13px; color: var(--rt-texto-suave); }

/* links com ícone */
.rt-db-link { display: inline-flex; align-items: center; gap: 6px; color: var(--rt-madeira-escura); font-weight: 800; text-decoration: none; vertical-align: middle; }
.rt-db-link:hover span, .rt-db-link:focus-visible span { text-decoration: underline; }
.rt-db-link img { flex: none; image-rendering: pixelated; max-height: 32px; width: auto; }
.rt-db-link--sem { color: var(--rt-texto-suave); }
.rt-db-sem-img { display: inline-block; width: 24px; height: 24px; border-radius: 6px; background: #f0e2c7; }
.rt-db-sem-img--mapa { width: 100%; aspect-ratio: 1; }
.rt-db-mini { display: inline-grid; place-items: center; width: 44px; height: 40px; margin-right: 6px; vertical-align: middle; }
.rt-db-mini img { max-width: 44px; max-height: 40px; width: auto; height: auto; }
.rt-db-mini--mapa img { border-radius: 6px; }
.rt-db-tabela td { vertical-align: middle; }
.rt-db-tabela--niveis th[scope="row"] { text-align: left; white-space: nowrap; }

.rt-db-atributos { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin: 0; padding: 0; list-style: none; }
.rt-db-atributos li { display: grid; place-items: center; padding: 8px 4px; border-radius: 12px; background: radial-gradient(circle at 50% 0, #fff7d6, #fde7a6); box-shadow: inset 0 0 0 2px #f2c86a; font-weight: 800; }
.rt-db-atributos abbr { text-decoration: none; font-size: 12px; color: var(--rt-texto-suave); }
.rt-db-atributos b { font-family: var(--rt-fonte-titulo); font-weight: 400; font-size: 22px; color: var(--rt-vermelho-escuro); }
.rt-db-exp b { font-size: 22px; }
.rt-db-exp small { display: block; font-weight: 600; color: var(--rt-texto-suave); }

.rt-db-grade-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 16px; margin: 0; padding: 0; list-style: none; }
.rt-db-mats { margin: 0; padding-left: 20px; }
.rt-db-npcs { columns: 3 220px; margin: 0; padding-left: 18px; }
.rt-db-npcs li { break-inside: avoid; }

/* filtros */
.rt-db-filtros { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px 14px; align-items: end; margin-bottom: 10px; }
.rt-db-filtros__campo { display: grid; gap: 4px; min-width: 0; }
.rt-db-filtros__campo--q { grid-column: span 2; }
.rt-db-filtros__campo label { font-weight: 800; font-size: 13px; color: var(--rt-texto-suave); }
.rt-db-filtros__campo .rt-entrada { width: 100%; min-width: 0; }
.rt-db-filtros__botoes { display: flex; align-items: center; gap: 12px; }
.rt-db-filtros__limpar { font-weight: 800; color: var(--rt-madeira); }
.rt-db-contagem { margin: 6px 0 12px; }

/* cartas e MVPs em grade */
.rt-db-cartas { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; margin: 0; padding: 0; list-style: none; }
.rt-db-carta { display: grid; gap: 6px; justify-items: center; padding: 8px; border-radius: 14px; text-decoration: none; color: var(--rt-texto); text-align: center; transition: transform .2s, background .2s; }
.rt-db-carta:hover, .rt-db-carta:focus-visible { background: #fff3d2; transform: translateY(-3px); }
.rt-db-carta img { width: 100%; height: auto; max-width: 142px; border-radius: 8px; box-shadow: 0 6px 14px rgba(74, 40, 18, .25); }
.rt-db-carta__sem { display: grid; place-items: center; width: 100%; max-width: 142px; aspect-ratio: 284 / 364; border-radius: 8px; background: #f3e2bf; }
.rt-db-carta__nome { font-weight: 900; line-height: 1.2; }
.rt-db-carta__onde { font-size: 12px; color: var(--rt-texto-suave); font-weight: 700; }
.rt-db-mvps { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin: 0; padding: 0; list-style: none; }
.rt-db-mvp-cartao { display: grid; gap: 4px; justify-items: center; height: 100%; box-sizing: border-box; padding: 12px 8px; border-radius: 14px; text-decoration: none; color: var(--rt-texto); text-align: center;
  background: radial-gradient(circle at 50% 30%, #fff7d6, #f4dfae); box-shadow: inset 0 0 0 2px #ecd29c; transition: transform .2s; }
.rt-db-mvp-cartao:hover, .rt-db-mvp-cartao:focus-visible { transform: translateY(-3px); }
.rt-db-mvp-cartao__arte { display: grid; place-items: end center; height: 130px; }
.rt-db-mvp-cartao__arte img { max-height: 130px; max-width: 150px; width: auto; height: auto; image-rendering: pixelated; }
.rt-db-mvp-cartao__nome { font-family: var(--rt-fonte-titulo); font-size: 18px; color: var(--rt-madeira-escura); }
.rt-db-mvp-cartao__info { font-size: 12px; font-weight: 700; color: var(--rt-texto-suave); }
.rt-db-mais { margin: 16px 0 0; text-align: center; }

/* capa */
.rt-db-capa__cabeca { margin-bottom: 8px; }
.rt-db-capa { margin: 0 auto 22px; }
.rt-db-secoes { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin: 0; padding: 0; list-style: none; }
.rt-db-secao { display: grid; gap: 2px; height: 100%; box-sizing: border-box; padding: 16px 16px 14px; border-radius: 16px; text-decoration: none; color: var(--rt-texto);
  background: linear-gradient(#fffaf0, #fbefd2); box-shadow: 0 0 0 2px #e9d3a3, var(--rt-sombra-cartao); transition: transform .2s; }
.rt-db-secao:hover, .rt-db-secao:focus-visible { transform: translateY(-3px); }
.rt-db-secao b { font-family: var(--rt-fonte-titulo); font-weight: 400; font-size: 30px; color: var(--rt-vermelho); line-height: 1; }
.rt-db-secao span { font-family: var(--rt-fonte-titulo); font-size: 20px; color: var(--rt-madeira-escura); }
.rt-db-secao small { color: var(--rt-texto-suave); font-weight: 700; }
.rt-db-rates b { font-size: 26px; }
.rt-db-cidades { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.rt-db-cidade { display: grid; gap: 6px; justify-items: center; text-align: center; text-decoration: none; color: var(--rt-texto); font-weight: 800; font-size: 13px; line-height: 1.2; }
.rt-db-cidade img { width: 96px; height: 96px; border-radius: 12px; box-shadow: 0 4px 10px rgba(74, 40, 18, .25); }
.rt-db-rodape { margin: 18px auto 0; font-size: 12px; color: var(--rt-texto-suave); text-align: center; }

/* lojas */
.rt-db-lojas { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.rt-db-loja { padding: 14px 16px; border-radius: 14px; background: #fffdf6; box-shadow: inset 0 0 0 2px #efe0c0; scroll-margin-top: 80px; }
.rt-db-loja:target { box-shadow: inset 0 0 0 3px var(--rt-ouro-escuro); }
.rt-db-loja__nome { margin: 0; font-family: var(--rt-fonte-titulo); font-weight: 400; font-size: 19px; color: var(--rt-madeira-escura); }
.rt-db-loja__onde { margin: 2px 0 10px; font-weight: 700; color: var(--rt-texto-suave); }
.rt-db-loja__itens { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.rt-db-loja__itens li { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.rt-db-preco { white-space: nowrap; color: var(--rt-vermelho-escuro); }

.rt-db-resultados { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 16px; margin: 0; padding: 0; list-style: none; }
.rt-db-resultados img { max-width: 32px; max-height: 32px; }

@media (max-width: 720px) {
  .rt-db-cabeca, .rt-db-cabeca--carta { grid-template-columns: minmax(0, 1fr); }
  .rt-db-fatos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rt-db-arte { min-height: 0; }
  .rt-db-arte--carta img { max-width: 220px; }
  .rt-db-atributos { grid-template-columns: repeat(3, 1fr); }
  .rt-db-filtros { grid-template-columns: 1fr 1fr; }
  .rt-db-filtros__campo--q { grid-column: 1 / -1; }
  .rt-db-busca__botao { padding-inline: 14px; }
  .rt-db-secoes { grid-template-columns: 1fr 1fr; }
  .rt-db-secao b { font-size: 24px; }
  .rt-db-lojas { grid-template-columns: 1fr; }
}

/* ---- celular: gaveta de filtros, abas numa linha que rola, tabelas em cartões ---- */
.rt-db-gaveta { margin: 0; }
.rt-db-gaveta > summary { display: none; }
@media (max-width: 720px) {
  .rt-db-gaveta > summary { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 12px; cursor: pointer; list-style: none;
    background: linear-gradient(#fffaf0, #f6e7c6); box-shadow: inset 0 0 0 2px #e2cfa6; font-weight: 900; color: var(--rt-madeira-escura); -webkit-tap-highlight-color: transparent; }
  .rt-db-gaveta > summary::-webkit-details-marker { display: none; }
  .rt-db-gaveta > summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border: solid currentColor; border-width: 0 3px 3px 0; transform: translateY(-2px) rotate(45deg); transition: transform .2s; }
  .rt-db-gaveta[open] > summary::after { transform: translateY(2px) rotate(-135deg); }
  .rt-db-gaveta[open] > summary { margin-bottom: 12px; }
  .rt-db-gaveta__n { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; box-sizing: border-box; border-radius: 99px; background: var(--rt-vermelho); color: #fff; font-size: 12px; }
  .rt-db-filtros { gap: 8px 10px; }
  .rt-db-filtros__botoes { grid-column: 1 / -1; }
  .rt-db-filtros__botoes .rt-botao { flex: 1; }

  .rt-db-abas.rt-abas--fluxo .rt-abas__lista { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; gap: 4px; padding: 0 2px; }
  .rt-db-abas .rt-abas__lista::-webkit-scrollbar { display: none; }
  .rt-db-abas.rt-abas--tira { padding: 6px; border-radius: 99px; }
  .rt-db-abas .rt-abas__aba { flex: none; white-space: nowrap; }
  .rt-db-topo { gap: 10px; }

  .rt-tabela-rolo:has(> .rt-db-tabela--cartoes) { overflow: visible; padding: 0; }
  .rt-db-tabela--cartoes, .rt-db-tabela--cartoes tbody { display: block; }
  .rt-db-tabela--cartoes thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .rt-db-tabela--cartoes tr { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px 16px; padding: 10px 12px; border-bottom: 1px solid rgba(160, 120, 70, .25); }
  .rt-db-tabela--cartoes tbody tr:last-child { border-bottom: 0; }
  .rt-db-tabela--cartoes tbody tr:nth-child(even) { background: rgba(255, 250, 235, .45); }
  .rt-db-tabela.rt-db-tabela--cartoes td { display: block; padding: 0; border: 0; background: none !important; text-align: left; white-space: normal; font-size: 14px; }
  .rt-db-tabela--cartoes td::before { content: attr(data-rot); display: block; font-size: 11px; font-weight: 900; letter-spacing: .4px; text-transform: uppercase; color: #b0632f; }
  .rt-db-tabela--cartoes td:first-child { flex: 1 0 100%; font-size: 15px; }
  .rt-db-tabela--cartoes td:first-child::before { display: none; }
  .rt-db-tabela--cartoes .rt-db-mini { width: 40px; height: 36px; }
}
@media (max-width: 720px) {
  .rt-db-arte--mob { grid-auto-flow: column; align-items: end; justify-content: space-evenly; }
  .rt-db-arte--mob figcaption { margin: 0; }
}
.rt-db-topo { grid-template-columns: minmax(0, 1fr); }
.rt-db-topo > * { min-width: 0; }
@media (max-width: 720px) {
  .rt-db-fatos { gap: 8px; }
  .rt-db-fatos > div { padding: 8px 12px; }
  .rt-db-fatos dd { font-size: 15px; }
  .rt-db-exp { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
  .rt-db-exp li { margin: 0; padding: 10px 8px; }
}
@media (max-width: 720px) {
  .rt-db-cartas { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 10px; }
  .rt-db-mvps { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
  .rt-db-mvp-cartao__arte { height: 104px; }
  .rt-db-mvp-cartao__arte img { max-height: 104px; max-width: 120px; }
  .rt-db-mvp-cartao__nome { font-size: 16px; }
  .rt-db-cidades { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
  .rt-db-cidade img { width: 80px; height: 80px; }
  .rt-db-grade-links { grid-template-columns: 1fr; }
  .rt-db-npcs { columns: 2 140px; }
}
@media (max-width: 720px) {
  .rt-db-rates { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .rt-db-rates li { padding: 10px 6px; font-size: 13px; }
}
