/*
 * Manual do Oh No! Spikes!!! — estilos partilhados por manual.html (pt-PT) e
 * en/manual.html. Mesma paleta e tipos de letra da página promocional
 * (assets/pagina.css), mas com fundo creme: é uma página para ler, e texto
 * corrido em cima do mostarda cansa a vista. O teal fica para a barra e os
 * títulos, o rosa do pássaro para os destaques.
 * Nenhum texto abaixo de 15px (regra do projecto).
 */
:root {
  --sky: #fecb3e;
  --abyss: #06455a;
  --abyss-deep: #043544;
  --bird: #ee1559;
  --beak: #9acb3a;
  --cream: #fff8dc;
  --paper: #fffdf4;      /* fundo das entradas */
  --ink: #062f3d;
  --muted: #3d5f6b;
  --line: #ecdfb5;
  --display: "Lilita One", "Arial Rounded MT Bold", 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(--cream);
  color: var(--ink);
  font: 400 17px/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--bird); font-weight: 700; }
:focus-visible { outline: 3px solid var(--bird); outline-offset: 3px; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 400; line-height: 1.1; margin: 0; letter-spacing: .01em; }
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: var(--abyss);
}
/* dentes por baixo da barra, como o teto do jogo (ver .dentes em pagina.css) */
.bar::after {
  content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 12px; background: var(--abyss);
  -webkit-mask: conic-gradient(from -36.87deg at 50% 100%, #000 73.74deg, #0000 0) 0 0 / 18px 100%;
          mask: conic-gradient(from -36.87deg at 50% 100%, #000 73.74deg, #0000 0) 0 0 / 18px 100%;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--cream); text-decoration: none; font: 400 22px/1 var(--display); flex: none; }
.brand img { width: 36px; height: 36px; border-radius: 10px; }
.brand span { color: var(--sky); }
.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(--ink);
  background: var(--cream); border: 0; border-radius: 999px;
  padding: 11px 16px;
}
.search input::placeholder { color: var(--muted); }
.count { color: var(--cream); 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: 8px 12px; cursor: pointer; list-style: none; user-select: none;
  font: 400 18px/1 var(--display); color: var(--cream);
  background: var(--abyss-deep); border-radius: 999px;
}
.lang summary::-webkit-details-marker { display: none; }
.lang summary:hover, .lang[open] summary { color: var(--sky); }
.lang summary svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.6; 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(--abyss-deep); box-shadow: 0 12px 24px rgba(0,0,0,.35);
}
.lang a { display: flex; gap: 10px; padding: 10px 12px; color: var(--cream); text-decoration: none; font-size: 16px; font-weight: 400; border-radius: 8px; }
.lang a:hover { background: var(--abyss); }
.lang a b { width: 26px; opacity: .7; }
.lang a[aria-current="true"], .lang a[aria-current="true"] b { color: var(--sky); opacity: 1; }

/* ---------- 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: 40px var(--gutter) 64px;
}
.toc { position: sticky; top: calc(var(--bar-h) + 28px); align-self: start; max-height: calc(100vh - var(--bar-h) - 48px); 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(--ink); text-decoration: none; font: 400 17px/1.25 var(--display); letter-spacing: .02em;
}
.toc li a:hover { background: var(--line); }
.toc li a.is-current { background: var(--abyss); color: var(--sky); }
.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(--line); }
}

/* Abertura: o cartaz do jogo em pequeno */
.intro-page { margin-bottom: 36px; }
.intro-page img { width: min(560px, 100%); border-radius: 18px; margin-bottom: 20px; }
.intro-page h1 { font-size: clamp(36px, 5vw, 56px); margin-bottom: 12px; }
.intro-page p { color: var(--muted); max-width: 68ch; }
.empty { color: var(--bird); font: 400 20px/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(--abyss); margin-bottom: 14px; }
.chapter-head svg { width: 40px; height: 40px; flex: none; }
.chapter-head h2 { font-size: clamp(28px, 3.4vw, 38px); }
.chapter-intro { color: var(--muted); max-width: 70ch; }
.entry {
  background: var(--paper); border: 2px solid var(--line); border-radius: 18px;
  padding: 20px 22px; margin-top: 16px;
}
.entry h3 { font-size: 24px; color: var(--abyss); 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(--bird); }
.entry .tip { color: var(--muted); font-size: 16px; margin: 0; }
.entry.hidden, .chapter.hidden { display: none; }
mark { background: var(--sky); color: var(--ink); border-radius: 4px; padding: 0 2px; }
.data { font: 700 16px/1 ui-monospace, "SF Mono", Menlo, monospace; white-space: nowrap; }

/* Entrada com imagem ao lado (capturas) */
.with-img { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 24px; align-items: start; }
.with-img > img { width: 200px; border-radius: 16px; }
@media (max-width: 640px) { .with-img { grid-template-columns: minmax(0, 1fr); } .with-img > img { width: 180px; } }

/* ---------- 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(--line); vertical-align: middle; }
th { font: 400 17px/1.2 var(--display); color: var(--abyss); white-space: nowrap; letter-spacing: .02em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
/* amostra da cor dos espinhos, com os mesmos dentes */
.amostra { display: inline-block; width: 36px; height: 22px; vertical-align: middle; margin-right: 8px; border-radius: 0 0 5px 5px;
  background: linear-gradient(var(--cc), var(--cc)) 0 7px / 100% 100% no-repeat; position: relative; }
.amostra::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 7px; background: var(--cc);
  -webkit-mask: conic-gradient(from 143.13deg at 50% 0, #000 73.74deg, #0000 0) 0 0 / 9px 100%;
          mask: conic-gradient(from 143.13deg at 50% 0, #000 73.74deg, #0000 0) 0 0 / 9px 100%; }
/* pássaro desenhado em SVG dentro de uma célula */
td svg.ave { width: 34px; height: 34px; vertical-align: middle; margin-right: 8px; }

.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(--line); }
.ach b { display: block; font: 400 19px/1.2 var(--display); color: var(--ink); letter-spacing: .02em; }
.ach span { color: var(--muted); font-size: 16px; }
@media (max-width: 700px) { .ach { grid-template-columns: minmax(0, 1fr); } }

kbd { font: 700 15px/1 var(--body); background: #fff; border: 2px solid var(--abyss); border-bottom-width: 4px; border-radius: 6px; padding: 2px 7px; }

footer { background: var(--abyss); color: var(--cream); padding: 24px var(--gutter) 40px; font-size: 16px; text-align: center; }
footer a { color: var(--cream); }
