/* Wiki do jogo (public/wiki/): páginas estáticas para ler no celular, no mesmo visual escuro das
   explorações. Pensada para 360–412 px em retrato; no desktop, uma coluna de até 720 px. */
html,
body {
  min-height: 100dvh;
}

body {
  display: flex;
  justify-content: center;
  padding: max(18px, env(safe-area-inset-top)) 14px max(28px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 50% -10%, rgba(124, 58, 237, 0.3), transparent 55%),
    var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

main {
  width: 100%;
  max-width: 720px;
  min-width: 0;
}

a {
  color: #c9b6ff;
  text-underline-offset: 3px;
}

.back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-bottom: 4px;
  font-weight: 700;
}

h1 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(30px, 9vw, 44px);
  line-height: 1.08;
  color: #f5f3ff;
  -webkit-text-stroke: 1.5px #1b1030;
  paint-order: stroke fill;
}

.lead {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 15px;
}

section {
  margin: 0 0 14px;
  padding: 14px 15px;
  border: 2px solid #2c2550;
  border-radius: 14px;
  background: rgba(20, 16, 40, 0.88);
  min-width: 0;
  scroll-margin-top: 12px;
}

h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 22px;
  line-height: 1.2;
  color: #e9ddff;
}

h3 {
  margin: 14px 0 6px;
  font-size: 16px;
  color: #f0e8ff;
}

p,
ul,
ol,
dl {
  margin: 0 0 9px;
}

ul,
ol {
  padding-left: 20px;
}

li {
  margin: 0 0 5px;
}

b,
strong {
  color: #f5f3ff;
}

code {
  padding: 1px 5px;
  border-radius: 5px;
  background: #0f0c1f;
  color: #d9c6ff;
  font-size: 0.9em;
  word-break: break-word;
}

.note {
  padding: 8px 11px;
  border-left: 4px solid #7c4ce0;
  border-radius: 6px;
  background: rgba(124, 76, 224, 0.12);
  font-size: 15px;
}

.note.new {
  border-left-color: #2fb866;
  background: rgba(47, 184, 102, 0.12);
}

.muted {
  color: var(--muted);
  font-size: 14px;
}

/* Sumário no alto de cada página. */
.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}

.toc li {
  margin: 0;
}

.toc a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 4px 11px;
  border: 1px solid #3a3166;
  border-radius: 999px;
  background: #1a1533;
  font-size: 14px;
  text-decoration: none;
}

/* Tabelas: poucas colunas; a que não couber rola sozinha, sem empurrar a página. */
.table-wrap {
  overflow-x: auto;
  margin: 0 0 9px;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 6px 7px;
  border-bottom: 1px solid #2c2550;
  text-align: left;
  vertical-align: top;
}

th {
  color: #e9ddff;
  font-weight: 700;
  white-space: nowrap;
}

td.num,
th.num {
  text-align: right;
  white-space: nowrap;
}

/* Lista de definição em pares (atributos). */
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 4px 10px;
  margin: 8px 0;
  font-size: 14px;
}

.facts div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 0;
  border-bottom: 1px dotted #3a3166;
}

.facts dt {
  color: var(--muted);
}

.facts dd {
  margin: 0;
  text-align: right;
  color: #f5f3ff;
}

/* Figuras (a arena em SVG). */
figure {
  margin: 10px 0;
}

figure svg {
  display: block;
  width: 100%;
  max-width: 300px;
  height: auto;
  margin: 0 auto;
  border-radius: 10px;
}

figcaption {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 12px;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  color: var(--muted);
}

.legend li {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0;
}

.legend i {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid #0006;
}

/* Índice: busca e lista de páginas. */
.search {
  display: block;
  width: 100%;
  min-height: 46px;
  margin: 0 0 12px;
  padding: 10px 14px;
  border: 2px solid #3a3166;
  border-radius: 12px;
  background: #0f0c1f;
  color: var(--text);
  font: inherit;
}

.search:focus {
  outline: none;
  border-color: #9a66ff;
}

.pages {
  margin: 0;
  padding: 0;
  list-style: none;
}

.pages > li {
  margin: 0 0 10px;
  padding: 12px 14px;
  border: 2px solid #2c2550;
  border-radius: 14px;
  background: rgba(20, 16, 40, 0.88);
}

.pages > li > a {
  display: block;
  font-family: var(--font-display);
  font-size: 21px;
  text-decoration: none;
  color: #e9ddff;
}

.pages > li > p {
  margin: 2px 0 6px;
  color: var(--muted);
  font-size: 14px;
}

.subs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
}

.subs li {
  margin: 0;
}

.subs a {
  display: inline-block;
  padding: 5px 0;
}

.search-cards {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.search-cards li {
  margin: 0;
  border-bottom: 1px solid #2c2550;
}

.search-cards a {
  display: block;
  padding: 9px 4px;
}

.search-cards small {
  color: var(--muted);
}

.empty {
  color: var(--muted);
  text-align: center;
}

.game-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  margin: 16px 0 0;
  border-radius: 12px;
  background: linear-gradient(#8b5cf6, #6d28d9);
  color: #fff;
  font-family: var(--font-display);
  font-size: 20px;
  text-decoration: none;
  box-shadow: 0 3px 0 #3b1580;
}

/* Domínios e cartas. */
.domain {
  border-color: color-mix(in srgb, var(--dom, #8f8a9e) 55%, #2c2550);
}

.domain > h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--dom-light, #e9ddff);
}

.domain > h2::before {
  content: "";
  flex: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--dom, #8f8a9e);
  box-shadow: 0 0 10px var(--dom, #8f8a9e);
}

.d-brasa { --dom: #e8622a; --dom-light: #ffc58f; }
.d-mare { --dom: #25a9b0; --dom-light: #a6f2e6; }
.d-raiz { --dom: #6fae3a; --dom-light: #c8ea8e; }
.d-sombra { --dom: #8a5cc0; --dom-light: #d6c6ee; }
.d-engrenagem { --dom: #c88a38; --dom-light: #f3d68c; }
.d-astro { --dom: #6b74e0; --dom-light: #c4cbff; }
.d-neutro { --dom: #8f8a9e; --dom-light: #e0dcea; }

.cards {
  margin: 10px 0 0;
}

.card {
  margin: 0 0 6px;
  border: 1px solid #3a3166;
  border-left: 4px solid var(--rar, #8a8a9a);
  border-radius: 10px;
  background: #16122c;
  scroll-margin-top: 12px;
}

.card[open] {
  background: #1b1636;
}

.card > summary {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 48px;
  padding: 6px 10px 6px 8px;
  cursor: pointer;
  list-style: none;
}

.card > summary::-webkit-details-marker {
  display: none;
}

.card > summary::after {
  content: "▾";
  flex: none;
  margin-left: auto;
  color: var(--muted);
  transition: transform 0.15s;
}

.card[open] > summary::after {
  transform: rotate(180deg);
}

.cost {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 32px;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: linear-gradient(#a78bfa, #6d28d9);
  color: #fff;
  font-family: var(--font-display);
  font-size: 17px;
  text-shadow: 0 1px 0 #2a1060;
}

.cname {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.cname b {
  font-size: 15px;
}

.cname small {
  color: var(--muted);
  font-size: 12.5px;
}

.cbody {
  padding: 2px 12px 10px;
  font-size: 14.5px;
}

.cbody .rules {
  margin: 6px 0;
  padding: 0;
  list-style: none;
}

.cbody .rules li {
  padding: 5px 9px;
  border-radius: 8px;
  background: #0f0c1f;
  color: #f2ecff;
}

.cbody .gloss {
  margin: 6px 0;
  padding-left: 16px;
  color: var(--muted);
  font-size: 13.5px;
}

.flavor {
  color: #b9b2d6;
  font-style: italic;
  font-size: 13.5px;
}

.r-common { --rar: #8a8a9a; }
.r-rare { --rar: #b9c6d8; }
.r-heroic { --rar: #9a5cf0; }
.r-legendary { --rar: #f2c14e; }

.rar {
  display: inline-block;
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid var(--rar);
  color: var(--rar);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 6px 0;
  padding: 0;
  list-style: none;
}

.chips li,
.chip {
  display: inline-block;
  margin: 0;
  padding: 2px 9px;
  border-radius: 999px;
  background: #2a2152;
  color: #e9ddff;
  font-size: 13px;
}

.chips a {
  text-decoration: none;
}

/* Barras simples (curva de custo). */
.bars {
  margin: 6px 0 10px;
  padding: 0;
  list-style: none;
  font-size: 13.5px;
}

.bars li {
  display: grid;
  grid-template-columns: 64px 1fr 34px;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px;
}

.bars span.bar {
  display: block;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, #7c3aed, #a78bfa);
}

.bars .n {
  text-align: right;
  color: #f5f3ff;
}

.kw h2 {
  margin-bottom: 4px;
}

.kw .gloss-main {
  font-size: 16px;
  color: #f5f3ff;
}

@media (min-width: 560px) {
  body {
    padding-left: 20px;
    padding-right: 20px;
  }

  section {
    padding: 16px 18px;
  }
}

/* Tipos de baú (progressao.html): um cartão por baú, que cabe no celular. */
.chest-kinds {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  list-style: none;
}

.chest-kinds li {
  padding: 10px 12px;
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-left: 5px solid #f2c14e;
  border-radius: 10px;
  background: rgba(20, 16, 40, 0.6);
}
