/*
 * Manual do MonsterBlokke — estilos partilhados por manual.html (pt-PT) e
 * en/manual.html. Mesma paleta e tipos de letra da página promocional
 * (index.html): roxo da noite, verde do logótipo, laranja da abóbora.
 * Nenhum texto abaixo de 15px (regra do projecto).
 */
:root {
  --night: #1b1030;
  --plum: #2a1745;
  --plum-2: #3a2160;
  --line: #553a82;
  --ink: #14112a;
  --text: #fbf3e6;
  --muted: #cbbbe2;
  --slime: #7ee03a;
  --amber: #ffb627;
  --magenta: #c93bbf;
  --display: "Fredoka", ui-rounded, system-ui, sans-serif;
  --body: "Nunito", system-ui, sans-serif;
  --gutter: clamp(16px, 3vw, 32px);
  --bar-h: 68px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--bar-h) + 16px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--night);
  color: var(--text);
  font: 400 17px/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--amber); }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; line-height: 1.1; margin: 0; }
p { margin: 0 0 .9em; }

/* ---------- Barra fixa do topo: marca, pesquisa e idioma ---------- */
.bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 18px;
  min-height: var(--bar-h); padding: 10px var(--gutter);
  background: rgba(27, 16, 48, .94);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 2px solid var(--plum-2);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font: 600 22px/1 var(--display); flex: none; }
.brand img { width: 36px; height: 36px; border-radius: 10px; }
.brand span { color: var(--slime); }
.search { flex: 1; display: flex; align-items: center; gap: 10px; max-width: 520px; margin-left: auto; }
.search input {
  width: 100%; font: 16px/1.2 var(--body); color: var(--text);
  background: var(--plum); border: 2px solid var(--line); border-radius: 999px;
  padding: 10px 16px;
}
.search input::placeholder { color: var(--muted); opacity: .8; }
.count { color: var(--muted); font-size: 15px; white-space: nowrap; }
@media (max-width: 640px) {
  .bar { flex-wrap: wrap; }
  .brand span { display: none; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
}

/* ---------- Selector de idioma (igual ao da página do jogo) ---------- */
.lang { position: relative; flex: none; }
.lang summary {
  display: flex; align-items: center; gap: 4px;
  padding: 7px 12px; cursor: pointer; list-style: none; user-select: none;
  font: 600 18px/1 var(--display); color: var(--text);
  background: var(--plum); border: 2px solid var(--line); border-radius: 999px; box-shadow: 0 0 0 2px var(--ink);
}
.lang summary::-webkit-details-marker { display: none; }
.lang summary:hover, .lang[open] summary { color: var(--slime); }
.lang summary svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; transition: transform .15s; }
.lang[open] summary svg { transform: rotate(180deg); }
.lang ul {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 50;
  min-width: 180px; margin: 0; padding: 6px; list-style: none; border-radius: 14px;
  background: var(--plum); border: 2px solid var(--line); box-shadow: 0 0 0 2px var(--ink), 0 12px 24px rgba(0,0,0,.5);
}
.lang a { display: flex; gap: 10px; padding: 10px 12px; color: var(--text); text-decoration: none; font-size: 16px; border-radius: 8px; }
.lang a:hover { background: var(--plum-2); }
.lang a b { width: 26px; color: var(--muted); }
.lang a[aria-current="true"], .lang a[aria-current="true"] b { color: var(--slime); }

/* ---------- Layout: índice à esquerda, capítulos à direita ---------- */
.layout {
  display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: clamp(24px, 4vw, 56px);
  max-width: 1320px; margin: 0 auto; padding: 32px var(--gutter) 64px;
}
.toc { position: sticky; top: calc(var(--bar-h) + 20px); align-self: start; max-height: calc(100vh - var(--bar-h) - 40px); overflow: auto; }
.toc h2 { font-size: 20px; color: var(--muted); margin-bottom: 10px; }
.toc ol { list-style: none; margin: 0 0 20px; padding: 0; }
.toc li a {
  display: block; padding: 7px 12px; border-radius: 10px;
  color: var(--text); text-decoration: none; font: 500 17px/1.25 var(--display);
}
.toc li a:hover { background: var(--plum); }
.toc li a.is-current { background: var(--plum-2); color: var(--slime); }
.toc .back { font-size: 16px; }
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .toc { position: static; max-height: none; }
  .toc ol { display: flex; flex-wrap: wrap; gap: 6px; }
  .toc li a { background: var(--plum); }
}

.intro-page { margin-bottom: 36px; }
.intro-page img { width: min(320px, 70%); margin-bottom: 18px; }
.intro-page h1 { font-size: clamp(36px, 5vw, 56px); margin-bottom: 12px; }
.intro-page p { color: var(--muted); max-width: 68ch; }
.empty { color: var(--amber); font: 600 19px/1.3 var(--display); }
.empty:empty { display: none; }

/* ---------- Capítulos e entradas ---------- */
.chapter { margin-bottom: 56px; }
.chapter-head { display: flex; align-items: center; gap: 14px; padding-bottom: 12px; border-bottom: 3px solid var(--plum-2); margin-bottom: 14px; }
.chapter-head img { width: 44px; flex: none; }
.chapter-head h2 { font-size: clamp(28px, 3.4vw, 38px); }
.chapter-intro { color: var(--muted); max-width: 70ch; }
.entry {
  background: var(--plum); border: 2px solid var(--line); border-radius: 18px;
  padding: 20px 22px; margin-top: 16px;
}
.entry h3 { font-size: 23px; color: var(--slime); margin-bottom: 10px; }
.entry p, .entry li { max-width: 72ch; }
.entry ul, .entry ol { margin: 0 0 .9em; padding-left: 1.3em; }
.entry li { margin-bottom: 6px; }
.entry li::marker { color: var(--amber); }
.entry .tip { color: var(--muted); font-size: 16px; margin: 0; }
.entry.hidden, .chapter.hidden { display: none; }
mark { background: var(--amber); color: var(--ink); border-radius: 4px; padding: 0 2px; }

/* Entrada com imagem ao lado (poderes, bloqueadores) */
.with-img { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 18px; align-items: start; }
.with-img > img { width: 84px; }

/* ---------- Tabelas ----------
   Largura total; no telemóvel deslizam na horizontal dentro do próprio quadro. */
.table-wrap { overflow-x: auto; margin: 4px 0 6px; }
table { width: 100%; border-collapse: collapse; font-size: 16px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--plum-2); vertical-align: middle; }
th { font: 600 16px/1.2 var(--display); color: var(--amber); white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
.mset { display: flex; gap: 2px; }
.mset img { width: 30px; }

/* ---------- Grelhas de imagens (monstros, conquistas) ---------- */
.monsters { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px; }
.monsters li { text-align: center; font: 500 16px/1.2 var(--display); color: var(--muted); }
.monsters img { width: 100%; max-width: 90px; margin: 0 auto 6px; }
@media (max-width: 640px) { .monsters { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.ach { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 24px; }
.ach li { padding: 10px 0; border-bottom: 1px solid var(--plum-2); }
.ach b { display: block; font: 600 18px/1.2 var(--display); color: var(--text); }
.ach span { color: var(--muted); font-size: 16px; }
@media (max-width: 700px) { .ach { grid-template-columns: minmax(0, 1fr); } }

footer { border-top: 2px solid var(--plum-2); padding: 24px var(--gutter) 40px; color: var(--muted); font-size: 16px; text-align: center; }
footer a { color: var(--text); }
