/* ============================================================================
   MINI GUIA DOS SISTEMAS DIVINE
   ----------------------------------------------------------------------------
   Abre ao clicar em qualquer card da seção "Sistemas Divine" (index.html).
   O layout é o mesmo da página de atualizações de propósito: índice à esquerda,
   leitura à direita. Assim o jogador troca de sistema sem precisar fechar nada.

   Onde mexer:
   - largura do painel ......... .system-guide-shell -> width
   - largura do índice ......... .system-guide-body -> grid-template-columns
   - conteúdo (texto/imagens) .. site.config.js -> systems[].details
   - traduções ................. i18n/<idioma>.js
   ========================================================================== */

.system-guide[hidden] { display: none; }

.system-guide {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  padding: clamp(14px, 3vw, 40px);
  overscroll-behavior: contain;
}

.system-guide-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 5, 8, .82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: systemGuideFade .22s ease;
}

.system-guide-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, 100%);
  max-height: min(860px, calc(100vh - 56px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(241, 213, 143, .34);
  background: linear-gradient(150deg, #14171c, #08090c 62%);
  box-shadow: 0 40px 110px rgba(0, 0, 0, .66);
  animation: systemGuideRise .34s cubic-bezier(.19, 1, .22, 1);
}

/* Fio dourado no topo, mesma assinatura das molduras do site. */
.system-guide-shell::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: .75;
}

/* ---------- Cabeçalho ---------- */

.system-guide-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px clamp(20px, 3vw, 32px);
  border-bottom: 1px solid rgba(227, 189, 111, .18);
  background: linear-gradient(100deg, rgba(211, 165, 79, .12), rgba(10, 12, 16, .9) 42%);
}

.system-guide-head .eyebrow { margin: 0; }

.system-guide-close {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(241, 213, 143, .32);
  background: rgba(7, 9, 12, .7);
  color: var(--gold-pale);
  cursor: pointer;
  transition: background .2s, border-color .2s, transform .25s;
}

.system-guide-close svg { width: 17px; height: 17px; }
.system-guide-close:hover { background: rgba(241, 213, 143, .16); border-color: var(--gold-pale); transform: rotate(90deg); }

/* ---------- Corpo: índice + leitura ---------- */

.system-guide-body {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  min-height: 0;
  flex: 1 1 auto;
}

.system-guide-sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 26px 0 18px;
  border-right: 1px solid rgba(227, 189, 111, .16);
  background: linear-gradient(180deg, #0d1015, #0a0c10);
}

.system-guide-sidebar::after {
  content: "";
  position: absolute;
  right: -1px;
  top: 76px;
  bottom: 0;
  width: 1px;
  background: linear-gradient(transparent, var(--gold), transparent);
  opacity: .45;
}

.system-guide-sidebar-title {
  display: block;
  padding: 0 24px 18px;
  color: #b7a171;
  font: 600 10px "Barlow Condensed", sans-serif;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.system-guide-nav {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  min-height: 0;
  /* chegou ao fim da lista, para: sem isso a rolagem "vaza" para a página de trás */
  overscroll-behavior: contain;
  /* mesma barra de rolagem dourada do índice de invasões */
  scrollbar-width: thin;
  scrollbar-color: var(--gold) rgba(6, 8, 10, .62);
}

.system-guide-nav::-webkit-scrollbar { width: 9px; }
.system-guide-nav::-webkit-scrollbar-track { background: linear-gradient(180deg, #080a0e, #14171d); border-left: 1px solid rgba(227, 189, 111, .12); }
.system-guide-nav::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #f0cf79, #9e7028); border: 2px solid #0d1014; border-radius: 8px; }
.system-guide-nav::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, #ffe7a4, #bd8531); }

.system-guide-nav button {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  border: 0;
  border-left: 2px solid transparent;
  background: transparent;
  padding: 14px 24px;
  color: #a4a5a8;
  cursor: pointer;
  transition: color .2s, background .2s, padding .25s;
}

.system-guide-nav button::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 50%;
  width: 5px;
  height: 5px;
  border-top: 1px solid var(--gold);
  border-right: 1px solid var(--gold);
  transform: translateY(-50%) rotate(45deg);
  opacity: 0;
  transition: opacity .2s;
}

.system-guide-nav button:hover,
.system-guide-nav button.is-active {
  background: rgba(211, 165, 79, .075);
  border-left-color: var(--gold);
  color: var(--gold-pale);
  padding-left: 28px;
}

.system-guide-nav button.is-active::after { opacity: 1; }

.system-guide-nav-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(211, 165, 79, .3);
  background: rgba(211, 165, 79, .06);
  overflow: hidden;
}

.system-guide-nav-icon img { width: 100%; height: 100%; object-fit: cover; }

.system-guide-nav-text { display: grid; gap: 3px; min-width: 0; }
.system-guide-nav-text strong { font: 600 14px Cinzel, serif; line-height: 1.2; }
.system-guide-nav-text span {
  color: #7d7f85;
  font: 600 9px "Barlow Condensed", sans-serif;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.system-guide-nav button.is-active .system-guide-nav-text span { color: #b79a60; }

/* ---------- Leitura ---------- */

.system-guide-detail {
  overflow-y: auto;
  min-height: 0;
  overscroll-behavior: contain;
  padding: 34px clamp(22px, 3.6vw, 52px) 46px;
  scrollbar-width: thin;
  scrollbar-color: var(--gold) rgba(6, 8, 10, .62);
}

.system-guide-detail::-webkit-scrollbar { width: 9px; }
.system-guide-detail::-webkit-scrollbar-track { background: linear-gradient(180deg, #080a0e, #14171d); }
.system-guide-detail::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #f0cf79, #9e7028); border: 2px solid #0d1014; border-radius: 8px; }

.system-guide-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  text-transform: uppercase;
  font: 600 10px "Barlow Condensed", sans-serif;
  letter-spacing: .14em;
}

.system-guide-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0 10px;
  border: 1px solid rgba(211, 165, 79, .38);
  background: rgba(211, 165, 79, .07);
  color: var(--gold-pale);
  font-size: 11px;
}

.system-guide-meta em { font-style: normal; color: #85878e; }

.system-guide-detail h2 {
  font: 600 clamp(28px, 3.6vw, 42px)/1.1 Cinzel, serif;
  margin: 16px 0 0;
  color: var(--cream);
}

.system-guide-intro {
  margin: 16px 0 0;
  max-width: 720px;
  color: #b8b8b4;
  font-size: 14px;
  line-height: 1.8;
}

/* Faixa de resumo, igual à das notas de atualização. */
.system-guide-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  max-width: 660px;
  margin: 28px 0 0;
  border: 1px solid rgba(227, 189, 111, .18);
  background: rgba(5, 7, 10, .26);
}

.system-guide-summary div { display: grid; gap: 5px; padding: 14px 18px; }
.system-guide-summary div + div { border-left: 1px solid rgba(227, 189, 111, .16); }
.system-guide-summary small {
  font: 600 10px "Barlow Condensed", sans-serif;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: #86898f;
}
.system-guide-summary strong { font: 600 16px Cinzel, serif; color: var(--gold-pale); }

/* Galeria */
.system-guide-media {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin: 30px 0 0;
  max-width: 860px;
}

.system-guide-media figure {
  margin: 0;
  padding: 8px;
  border: 1px solid rgba(218, 174, 83, .6);
  background: linear-gradient(135deg, rgba(211, 165, 79, .11), rgba(0, 0, 0, .2));
  box-shadow: 0 12px 30px rgba(0, 0, 0, .23);
}

.system-guide-media img {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  background: #050607;
  cursor: zoom-in;
  transition: opacity .2s;
}

.system-guide-media img:hover { opacity: .86; }

.system-guide-media figcaption {
  padding: 9px 4px 2px;
  color: #b7b3a8;
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

.system-guide-rule {
  height: 1px;
  margin: 34px 0 6px;
  background: linear-gradient(90deg, var(--gold), transparent 70%);
  opacity: .5;
}

.system-guide-section { margin-top: 26px; }

.system-guide-section > h3 {
  margin: 0 0 4px;
  color: #b7a171;
  font: 600 11px "Barlow Condensed", sans-serif;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.system-guide-item {
  display: flex;
  gap: 13px;
  padding: 15px 0;
  border-top: 1px solid rgba(255, 255, 255, .07);
}

.system-guide-item > span { color: var(--gold); font-size: 15px; line-height: 1.4; }
.system-guide-item h4 { font: 600 15px Cinzel, serif; margin: 0 0 5px; }
.system-guide-item p { margin: 0; color: #9c9da1; font-size: 13px; line-height: 1.65; }

/* Imagem individual dentro de um item de texto (ex.: abaixo de "Recompensas à vista").
   Nunca estica: o tamanho é o tamanho real da imagem, só limitado pela largura
   disponível. Por padrão fica alinhada à esquerda; use imageAlign: 'center' no
   item para centralizar. */
.system-guide-item-image {
  margin: 12px 0 0;
  padding: 8px;
  display: inline-block;
  border: 1px solid rgba(218, 174, 83, .4);
  background: linear-gradient(135deg, rgba(211, 165, 79, .08), rgba(0, 0, 0, .18));
}
.system-guide-item-image.is-centered { display: block; width: fit-content; margin-left: auto; margin-right: auto; }
.system-guide-item-image.is-right { display: block; width: fit-content; margin-left: auto; margin-right: 0; }
.system-guide-item-image img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  cursor: zoom-in;
  transition: opacity .2s;
}
.system-guide-item-image img:hover { opacity: .86; }
.system-guide-item-image figcaption {
  padding: 7px 2px 0;
  font-size: 11px;
  line-height: 1.5;
  color: #b7b3a8;
  text-align: center;
}

/* Galeria dentro de um item de texto, quando o tópico tem 2+ imagens (item.images).
   Mesma ideia da galeria do guia (.system-guide-media), só que menor e embutida
   no tópico. Com 1 imagem só, continua usando .system-guide-item-image acima. */
.system-guide-item-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 220px));
  gap: 10px;
  margin: 12px 0 0;
}
.system-guide-item-images.is-centered { justify-content: center; }
.system-guide-item-images.is-right { justify-content: end; }
.system-guide-item-images figure {
  margin: 0;
  padding: 8px;
  border: 1px solid rgba(218, 174, 83, .4);
  background: linear-gradient(135deg, rgba(211, 165, 79, .08), rgba(0, 0, 0, .18));
}
.system-guide-item-images img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 220px;
  object-fit: cover;
  background: #050607;
  cursor: zoom-in;
  transition: opacity .2s;
}
.system-guide-item-images img:hover { opacity: .86; }
.system-guide-item-images figcaption {
  padding: 7px 2px 0;
  font-size: 11px;
  line-height: 1.5;
  color: #b7b3a8;
  text-align: center;
}

/* Dica de campo, mesmo bloco usado no Guia de invasões. */
.system-guide-tip {
  display: flex;
  gap: 14px;
  margin-top: 28px;
  padding: 18px 20px;
  border: 1px solid rgba(211, 165, 79, .28);
  background: linear-gradient(120deg, rgba(211, 165, 79, .1), rgba(10, 12, 16, .5));
}

.system-guide-tip > span { color: var(--gold); font-size: 16px; }
.system-guide-tip strong {
  display: block;
  margin-bottom: 6px;
  color: var(--gold-pale);
  font: 600 10px "Barlow Condensed", sans-serif;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.system-guide-tip p { margin: 0; color: #b3b4b8; font-size: 13px; line-height: 1.65; }

.system-guide-foot { margin-top: 32px; display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }

/* Passo a passo entre sistemas, no rodapé da leitura. */
.system-guide-step {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(241, 213, 143, .28);
  background: rgba(7, 9, 12, .6);
  color: #c9c4b6;
  padding: 11px 15px;
  cursor: pointer;
  font: 600 10px "Barlow Condensed", sans-serif;
  letter-spacing: .12em;
  text-transform: uppercase;
  transition: color .2s, border-color .2s, background .2s;
}

.system-guide-step:hover { color: var(--gold-pale); border-color: var(--gold-pale); background: rgba(211, 165, 79, .1); }

/* ---------- Lightbox da galeria (mesmas regras da página de atualizações) ---------- */

.media-lightbox[hidden] { display: none; }

.media-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1200;
  overscroll-behavior: contain;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 24px;
  background: rgba(6, 7, 9, .94);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: systemGuideFade .22s ease;
}

.media-lightbox-figure {
  position: relative;
  margin: 0;
  max-width: min(1200px, 92vw);
  max-height: calc(100vh - 112px);
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: systemGuideZoom .28s cubic-bezier(.19, 1, .22, 1);
}

.media-lightbox-figure img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 160px);
  width: auto;
  height: auto;
  object-fit: contain;
  border: 1px solid rgba(218, 174, 83, .55);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}

.media-lightbox-figure figcaption {
  margin-top: 16px;
  color: #d7d1c1;
  font: 500 13px/1.6 "Barlow Condensed", sans-serif;
  text-align: center;
  max-width: 640px;
}

.media-lightbox-figure figcaption:empty { display: none; }

.media-lightbox-close {
  position: absolute;
  top: 22px;
  right: 26px;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f1d58f;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(241, 213, 143, .35);
  cursor: pointer;
  transition: background .2s, transform .2s, border-color .2s;
}

.media-lightbox-close:hover { background: rgba(241, 213, 143, .16); border-color: var(--gold-pale); transform: rotate(90deg); }
.media-lightbox-close svg { width: 18px; height: 18px; }

/* ---------- Gatilho no card ---------- */

.system-detail-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 13px;
  color: var(--gold-pale);
  font: 700 10px "Barlow Condensed", sans-serif;
  letter-spacing: .12em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .25s, transform .25s;
}

.system-detail-trigger b { font-size: 14px; }
.system-card:hover .system-detail-trigger,
.system-card:focus-visible .system-detail-trigger { opacity: 1; transform: none; }

/* Trava de rolagem (ver lockScroll em app.js). O body fica fixo na posição em que
   estava, o que impede a página de fundo de andar em qualquer navegador, inclusive
   no Safari do iPhone, onde `overflow:hidden` sozinho não segura. */
.modal-open {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
  overflow: hidden;
}

@keyframes systemGuideFade { from { opacity: 0 } to { opacity: 1 } }
@keyframes systemGuideRise { from { opacity: 0; transform: translateY(22px) scale(.985) } to { opacity: 1; transform: none } }
@keyframes systemGuideZoom { from { opacity: 0; transform: scale(.96) } to { opacity: 1; transform: none } }

/* ---------- Telas menores ---------- */

@media (max-width: 900px) {
  .system-guide { padding: 0; }
  .system-guide-shell { width: 100%; max-height: 100vh; height: 100vh; }
  /* minmax(0, 1fr): sem ele, a fileira de botões do índice (6 x 208px) alargava a coluna e o guia inteiro passava da tela. */
  .system-guide-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .system-guide-sidebar {
    border-right: 0;
    border-bottom: 1px solid rgba(227, 189, 111, .16);
    padding: 18px 0 0;
  }
  .system-guide-sidebar::after { display: none; }
  .system-guide-sidebar-title { padding-bottom: 12px; }
  .system-guide-nav { flex-direction: row; overflow-x: auto; overflow-y: hidden; }
  .system-guide-nav::-webkit-scrollbar { height: 7px; width: auto; }
  .system-guide-nav button {
    min-width: 208px;
    border-left: 0;
    border-bottom: 2px solid transparent;
    padding: 12px 18px;
  }
  .system-guide-nav button:hover,
  .system-guide-nav button.is-active { padding-left: 18px; border-left: 0; border-bottom-color: var(--gold); }
  .system-guide-nav button::after { display: none; }
  .system-detail-trigger { opacity: 1; transform: none; }
}

@media (max-width: 560px) {
  .system-guide-summary { grid-template-columns: 1fr; }
  .system-guide-summary div + div { border-left: 0; border-top: 1px solid rgba(227, 189, 111, .16); }
  .system-guide-media { grid-template-columns: 1fr; }
  .system-guide-item-images { grid-template-columns: 1fr; justify-content: stretch; }
  .media-lightbox { padding: 70px 14px 24px; }
  .media-lightbox-close { top: 14px; right: 14px; width: 38px; height: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  html:not(.force-motion) .system-guide-backdrop,
  html:not(.force-motion) .system-guide-shell,
  html:not(.force-motion) .media-lightbox,
  html:not(.force-motion) .media-lightbox-figure { animation: none; }
  html:not(.force-motion) .system-detail-trigger { opacity: 1; transform: none; transition: none; }
}

/* ---------- Capítulo sozinho (tela do VIP, #vip): sem o índice ao lado ---------- */
.system-guide.is-single .system-guide-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.system-guide.is-single .system-guide-sidebar { display: none; }
.system-guide.is-single .system-guide-shell { max-width: 1040px; }
