/*--------------------------------------------------------------
# Manuale di gioco (docs.php)
# Caricato dopo compact.css (CSS del gioco, serve per le icone di unita' e risorse) e dopo style.css:
# i selettori partono da .docs per vincere sugli stili generici di tabelle e link di compact.css.
--------------------------------------------------------------*/
/* Scrollbar arancione come in style.css: serve anche nel popup di gioco (embed), che non carica style.css */
html {
  scrollbar-color: #fd680e #f3e6d2;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #f3e6d2;
}

::-webkit-scrollbar-thumb {
  background: #fd680e;
  border-radius: 8px;
  border: 2px solid #f3e6d2;
}

::-webkit-scrollbar-thumb:hover {
  background: #e65c00;
}

.docs {
  --docs-ink: #2b2420;
  --docs-muted: #7a6f66;
  --docs-line: #e8dfd6;
  --docs-paper: #fbf8f4;
  --docs-card: #ffffff;
  --docs-primary: #7a1212;
  --docs-accent: #fd680e;
  --docs-accent-soft: #fff1e6;
  --docs-radius: 12px;
  color: var(--docs-ink);
  font-family: "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  text-align: left;
}

.docs *,
.docs *::before,
.docs *::after {
  box-sizing: border-box;
}

.docs a:link,
.docs a:visited {
  color: var(--docs-primary);
  text-decoration: none;
}

.docs a:hover,
.docs a:focus-visible {
  color: var(--docs-accent);
}

.docs h1,
.docs h2,
.docs h3 {
  font-family: "Raleway", system-ui, sans-serif;
  color: var(--docs-ink);
  line-height: 1.25;
  margin: 0 0 .5em;
  padding: 0;
  background: none;
  border: 0;
}

.docs h1 { font-size: clamp(26px, 4vw, 34px); font-weight: 700; }
.docs h2 { font-size: 21px; font-weight: 700; }
.docs h3 { font-size: 16px; font-weight: 700; margin-top: 1.2em; }

.docs img.unit,
.docs img.r1, .docs img.r2, .docs img.r3, .docs img.r4, .docs img.r5,
.docs img.clock, .docs img.att_all, .docs img.def_i, .docs img.def_c, .docs img.carry {
  vertical-align: -3px;
}

/* Layout: indice a sinistra, contenuto a destra */
.docs-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 28px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 20px 56px;
}

.docs-side {
  position: sticky;
  top: 90px;
  align-self: start;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  padding: 16px;
  background: var(--docs-card);
  border: 1px solid var(--docs-line);
  border-radius: var(--docs-radius);
  box-shadow: 0 6px 24px rgba(60, 20, 10, .06);
}

.docs-main {
  min-width: 0;
  padding: 28px 32px;
  background: var(--docs-card);
  border: 1px solid var(--docs-line);
  border-radius: var(--docs-radius);
  box-shadow: 0 6px 24px rgba(60, 20, 10, .06);
}

/* Ricerca */
.docs-search {
  position: relative;
  margin-bottom: 14px;
}

.docs-search > .bx {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--docs-muted);
  font-size: 18px;
}

.docs-search input {
  width: 100%;
  padding: 9px 12px 9px 38px;
  font-size: 14px;
  color: var(--docs-ink);
  background: var(--docs-paper);
  border: 1px solid var(--docs-line);
  border-radius: 999px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

.docs-search input:focus {
  border-color: var(--docs-accent);
  box-shadow: 0 0 0 3px rgba(253, 104, 14, .18);
}

.docs-results {
  list-style: none;
  margin: 6px 0 0;
  padding: 4px;
  max-height: 360px;
  overflow-y: auto;
  background: var(--docs-card);
  border: 1px solid var(--docs-line);
  border-radius: 10px;
}

.docs-results li a {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
}

.docs-results li a.focus,
.docs-results li a:hover {
  background: var(--docs-accent-soft);
}

.docs-results small {
  color: var(--docs-muted);
  white-space: nowrap;
}

.docs-results .docs-empty {
  padding: 8px 10px;
  color: var(--docs-muted);
}

/* Selettore lingua */
.docs-lang {
  position: relative;
  margin-bottom: 10px;
}

.docs-lang summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  cursor: pointer;
  list-style: none;
  font-size: 14px;
  font-weight: 600;
  background: var(--docs-paper);
  border: 1px solid var(--docs-line);
  border-radius: 999px;
  transition: border-color .2s;
}

.docs-lang summary::-webkit-details-marker { display: none; }
.docs-lang summary:hover { border-color: var(--docs-accent); }
.docs-lang summary span { flex: 1; }
.docs-lang summary .bx { transition: transform .2s; }
.docs-lang[open] summary .bx { transform: rotate(180deg); }

.docs-lang img {
  width: 20px;
  height: 15px;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .12);
  flex: none;
}

.docs-lang ul {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  list-style: none;
  margin: 0;
  padding: 4px;
  max-height: 340px;
  overflow-y: auto;
  background: var(--docs-card);
  border: 1px solid var(--docs-line);
  border-radius: var(--docs-radius);
  box-shadow: 0 8px 24px rgba(43, 36, 32, .15);
}

.docs-lang li a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 14px;
}

.docs-lang li a:hover { background: var(--docs-paper); }

.docs-lang li.active > a {
  background: var(--docs-accent-soft);
  color: var(--docs-accent);
  font-weight: 600;
}

/* Indice */
.docs-nav details {
  border-top: 1px solid var(--docs-line);
  padding: 8px 0;
}

.docs-nav summary {
  cursor: pointer;
  list-style: none;
  padding: 6px 4px;
  font-family: "Raleway", sans-serif;
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--docs-primary);
}

.docs-nav summary::-webkit-details-marker { display: none; }

.docs-nav summary::after {
  content: "\203A";
  float: right;
  transition: transform .2s;
}

.docs-nav details[open] > summary::after {
  transform: rotate(90deg);
}

.docs-nav ul {
  list-style: none;
  margin: 0 0 6px;
  padding: 0;
}

.docs-nav li a,
.docs-nav a.docs-nav-cat {
  display: block;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 14px;
}

.docs-nav a.docs-nav-cat {
  margin-top: 6px;
  font-weight: 700;
  font-size: 13px;
  color: var(--docs-muted);
}

.docs-nav li a:hover,
.docs-nav a.docs-nav-cat:hover {
  background: var(--docs-paper);
}

.docs-nav li.active > a,
.docs-nav a.docs-nav-cat.active {
  background: var(--docs-accent-soft);
  color: var(--docs-accent);
  font-weight: 600;
}

/* Barra sopra il contenuto */
.docs-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-bottom: 18px;
}

.docs-crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--docs-muted);
}

.docs-crumbs .bx-chevron-right { opacity: .6; }

.docs-menu-btn {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 14px;
  color: var(--docs-primary);
  background: var(--docs-paper);
  border: 1px solid var(--docs-line);
  border-radius: 999px;
  cursor: pointer;
}

.docs-open-full {
  margin-left: auto;
  font-size: 13px;
  font-weight: 600;
}

/* Intestazione della pagina */
.docs-head {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--docs-line);
}

.docs-head-split {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.docs-kicker {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--docs-accent);
}

.docs-lead {
  margin: 0;
  font-size: 16px;
  color: #4d433c;
}

.docs-hero-img {
  flex: none;
  max-width: 150px;
  max-height: 150px;
  object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .18));
}

.docs-head-icons img.unit { margin-right: 4px; }

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

/* style.css dà padding e overflow a tutte le <section> del sito pubblico */
.docs section.docs-section { margin: 0 0 28px; padding: 0; overflow: visible; }

/* Elenco di dati (etichetta / valore) */
.docs-facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
  margin: 0 0 12px;
}

.docs-facts > div {
  padding: 10px 14px;
  background: var(--docs-paper);
  border: 1px solid var(--docs-line);
  border-radius: 10px;
}

.docs-facts dt {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--docs-muted);
}

.docs-facts dd {
  margin: 2px 0 0;
}

.docs-cost img { margin-left: 6px; }
.docs-cost img:first-child { margin-left: 0; }

.docs-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.docs-stat {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  font-size: 18px;
  font-weight: 700;
  background: var(--docs-paper);
  border: 1px solid var(--docs-line);
  border-radius: 999px;
}

.docs-notes,
.docs-points {
  margin: 0 0 12px;
  padding-left: 20px;
}

.docs-notes li,
.docs-points li { margin: 4px 0; }

.docs-points li::marker { color: var(--docs-accent); }

.docs-callout {
  padding: 12px 16px;
  background: var(--docs-accent-soft);
  border-left: 4px solid var(--docs-accent);
  border-radius: 8px;
}

/* Formula su una riga a se' (danno delle catapulte) */
.docs-formula {
  font-weight: 600;
  text-align: center;
}

/* Prerequisiti */
.docs-req {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
}

.docs-req li {
  padding: 6px 12px;
  background: var(--docs-paper);
  border: 1px solid var(--docs-line);
  border-radius: 999px;
}

.docs-req em {
  font-style: normal;
  font-size: 12px;
  color: var(--docs-muted);
  text-transform: uppercase;
  margin: 0 4px;
}

.docs-lvl {
  font-size: 12px;
  font-weight: 700;
  color: var(--docs-accent);
}

.docs-req-or {
  margin: 4px 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--docs-muted);
}

/* Schede */
.docs-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.docs-cards-wide { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

.docs .docs-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  color: var(--docs-ink);
  background: var(--docs-paper);
  border: 1px solid var(--docs-line);
  border-radius: var(--docs-radius);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}

.docs .docs-card:hover {
  color: var(--docs-ink);
  transform: translateY(-2px);
  border-color: var(--docs-accent);
  box-shadow: 0 8px 20px rgba(60, 20, 10, .1);
}

.docs-card-title {
  font-family: "Raleway", sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--docs-primary);
}

.docs-card-sub { font-size: 13px; color: var(--docs-muted); }

.docs-card-units { display: flex; flex-wrap: wrap; gap: 2px; }

.docs-card-img { height: 72px; }

.docs-card-pic { height: 72px; width: auto; }

.docs-card-topic { flex-direction: row; align-items: center; gap: 10px; }

.docs-card-topic .bx { font-size: 24px; color: var(--docs-accent); }

.docs-badge {
  display: inline-block;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--docs-primary);
  background: #f4e7df;
  border-radius: 999px;
}

.docs-card .docs-badge-gold {
  position: absolute;
  top: 10px;
  right: 10px;
  color: #7a4b00;
  background: #ffe7a8;
}

.docs-badges { display: flex; flex-wrap: wrap; gap: 4px; }

/* Elenco edifici di una categoria */
.docs-blist {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.docs .docs-bitem {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  color: var(--docs-ink);
  background: var(--docs-paper);
  border: 1px solid var(--docs-line);
  border-radius: var(--docs-radius);
  transition: border-color .15s, box-shadow .15s;
}

.docs .docs-bitem:hover {
  color: var(--docs-ink);
  border-color: var(--docs-accent);
  box-shadow: 0 6px 16px rgba(60, 20, 10, .08);
}

.docs-bitem-img { flex: none; width: 56px; text-align: center; }

.docs-bitem-pic { max-width: 56px; max-height: 72px; }

.docs-bitem-body { display: flex; flex-direction: column; gap: 3px; }

/* Collegamenti a pillola */
.docs-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }

.docs .docs-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  font-size: 13px;
  background: var(--docs-paper);
  border: 1px solid var(--docs-line);
  border-radius: 999px;
}

.docs .docs-chip-hit { border-color: #f1b9a0; background: #fff3ee; }
.docs .docs-chip-safe { color: var(--docs-muted); }

.docs-see-also { margin: 0 0 24px; }

/* Tabelle */
.docs-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--docs-line);
  border-radius: 10px;
}

.docs-table-tall { max-height: 560px; overflow-y: auto; }

.docs table.docs-table {
  width: 100%;
  margin: 0;
  border: 0;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--docs-card);
  font-size: 14px;
}

.docs table.docs-table th,
.docs table.docs-table td {
  padding: 8px 12px;
  text-align: right;
  white-space: nowrap;
  color: var(--docs-ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--docs-line);
}

.docs table.docs-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  font-weight: 700;
  text-align: right;
  background: #f6efe8;
}

.docs table.docs-table tbody th {
  text-align: left;
  font-weight: 600;
}

.docs table.docs-table thead th:first-child { text-align: left; }

.docs table.docs-table tbody tr:nth-child(even) td,
.docs table.docs-table tbody tr:nth-child(even) th { background: #fcfaf7; }

.docs table.docs-table tbody tr:hover td,
.docs table.docs-table tbody tr:hover th { background: var(--docs-accent-soft); }

.docs table.docs-table tr:last-child td,
.docs table.docs-table tr:last-child th { border-bottom: 0; }

.docs table.docs-table tr.docs-row-capital td,
.docs table.docs-table tr.docs-row-capital th { color: var(--docs-muted); }

.docs table.docs-table tr.docs-row-group td {
  text-align: left;
  white-space: normal;
  font-size: 13px;
  color: var(--docs-muted);
  background: var(--docs-paper);
}

.docs table.docs-units td:last-child { text-align: left; }

/* Pagina precedente / successiva */
.docs-pager {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--docs-line);
}

.docs-server-note {
  margin: 28px 0 0;
  padding-top: 14px;
  font-size: 12px;
  color: var(--docs-muted);
  border-top: 1px dashed var(--docs-line);
}

/* Schermi stretti e popup del gioco (iframe di circa 400 px): l'indice diventa un pannello a scomparsa */
@media (max-width: 900px) {
  .docs-layout {
    grid-template-columns: minmax(0, 1fr);
    padding: 16px 10px 32px;
  }

  .docs-side {
    display: none;
    position: static;
    max-height: none;
  }

  .docs-side.open { display: block; }

  .docs-menu-btn { display: inline-flex; }

  .docs-main { padding: 18px 16px; }

  .docs-head-split { flex-direction: column-reverse; }

  .docs-hero-img { max-width: 110px; max-height: 110px; }
}

/* Dentro il popup di gioco */
body.docs-embed {
  margin: 0;
  background: #fff;
}

.docs-embed .docs-layout { padding: 0; gap: 0; }

.docs-embed .docs-main,
.docs-embed .docs-side {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.docs-embed .docs-side { border-bottom: 1px solid var(--docs-line); }

/* ---------- Login fisso: per tornare al gioco dopo aver letto il manuale ---------- */
/* Compare (docs.js) quando i pulsanti del banner escono dallo schermo. Desktop: pillola in basso a destra */
.docs-login-cta {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 999;
  padding: 11px 26px;
  border-radius: 50px;
  font-weight: 700;
  color: #fff;
  background: #1769c2;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .35);
  transform: translateY(200%);
  transition: transform .3s, background .2s;
}

.docs-login-cta.visible { transform: none; }

.docs-login-cta:hover,
.docs-login-cta:focus-visible {
  color: #fff;
  text-decoration: none;
  background: #2f86e4;
}

/* Mobile: barra a tutta larghezza come la CTA di registrazione della index */
@media (max-width: 767px) {
  .docs-login-cta {
    left: 12px;
    right: 12px;
    bottom: 12px;
    padding: 13px;
    font-size: 17px;
    text-align: center;
  }

  /* Spazio in fondo: il pulsante non deve coprire il footer */
  body.has-docs-login #footer { padding-bottom: 80px; }
}
