/* ── Dofus Touch Detonado ─ hand-built game-flavored UI ─────────────────── */

:root {
  --bg-deep: #1b120c;
  --bg-wood: #2a1b11;
  --panel: #33221525;
  --parch: #f3e5c2;
  --parch-dark: #e7d3a4;
  --parch-edge: #c9ad72;
  --ink: #3c2a16;
  --ink-soft: #6b5232;
  --gold: #d8a531;
  --gold-bright: #ffd257;
  --green: #7ab51d;
  --green-dark: #5c8f12;
  --boss: #a8352c;
  --water: #3f83c9;
  --font-display: "Baloo 2", "Trebuchet MS", sans-serif;
  --font-body: "Nunito", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 50% -100px, #47301c66, transparent 70%),
    radial-gradient(900px 700px at 110% 30%, #14300f33, transparent 60%),
    repeating-linear-gradient(93deg, #00000000 0 90px, #00000014 90px 92px),
    linear-gradient(180deg, var(--bg-wood), var(--bg-deep) 600px);
  background-attachment: fixed;
  min-height: 100vh;
}

/* ── top bar ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 22px;
  background: linear-gradient(180deg, #100a06f2, #241710f2);
  border-bottom: 2px solid #000;
  box-shadow: 0 1px 0 #ffffff14 inset, 0 4px 14px #0009;
  position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand__mark {
  width: 38px; height: 38px; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 24px;
  color: #2a1500;
  background: radial-gradient(circle at 30% 25%, var(--gold-bright), var(--gold) 60%, #9c6d12);
  border-radius: 50%;
  border: 2px solid #5d3f0b;
  box-shadow: 0 2px 0 #00000088, 0 0 0 2px #ffd25733 ;
}
.brand__text {
  font-family: var(--font-display); font-weight: 800; font-size: 20px;
  color: var(--parch); letter-spacing: .4px;
  text-shadow: 0 2px 0 #000;
}
.brand__text em { color: var(--gold-bright); font-style: normal; }
.topbar__nav a {
  color: var(--parch); text-decoration: none; font-weight: 700;
  font-family: var(--font-display); font-size: 16px;
  padding: 6px 14px; border-radius: 10px;
  background: #ffffff10; border: 1px solid #ffffff1c;
}
.topbar__nav a:hover { background: #ffffff22; }

/* ── index hero ── */
.hero { padding: 54px 20px 30px; text-align: center; }
.hero h1 {
  margin: 0;
  font-family: var(--font-display); font-weight: 800; font-size: clamp(34px, 6vw, 56px);
  color: var(--gold-bright);
  text-shadow: 0 3px 0 #4a2c05, 0 6px 18px #000;
  letter-spacing: .5px;
}
.hero p { color: #e8d9b8; font-size: 18px; margin: 10px 0 24px; text-shadow: 0 1px 2px #000; }
.hero__search {
  width: min(440px, 90vw);
  font: 600 17px var(--font-body);
  color: var(--ink);
  padding: 12px 20px;
  border-radius: 999px;
  border: 2px solid #5d3f0b;
  background: var(--parch);
  box-shadow: 0 3px 0 #00000066, inset 0 2px 4px #00000022;
  outline: none;
}
.hero__search:focus { border-color: var(--gold-bright); }

/* ── layout ── */
.wrap { max-width: 1120px; margin: 0 auto; padding: 10px 20px 60px; }

.group__title {
  display: flex; align-items: center; gap: 14px;
  font-family: var(--font-display); font-weight: 800; font-size: 24px;
  color: var(--parch); text-shadow: 0 2px 0 #000;
  margin: 38px 4px 14px;
}
.group__title::before, .group__title::after {
  content: ""; height: 3px; flex: 1;
  background: linear-gradient(90deg, transparent, var(--gold) 30%, var(--gold) 70%, transparent);
  border-radius: 2px; opacity: .55;
}
.group__title::before { background: linear-gradient(90deg, var(--gold), transparent); flex: 0 0 44px; }
.group__title span { white-space: nowrap; }

/* ── dungeon cards ── */
.grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.card {
  position: relative; display: block; text-decoration: none;
  border-radius: 16px;
  background: linear-gradient(180deg, var(--parch), var(--parch-dark));
  border: 2px solid #241505;
  box-shadow: 0 0 0 2px var(--gold) , 0 8px 18px #000a;
  overflow: visible;
  transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 0 0 2px var(--gold-bright), 0 14px 26px #000c; }
.card__banner {
  height: 118px; border-radius: 13px 13px 0 0;
  background-size: cover; background-position: center 30%;
  filter: saturate(1.05);
  border-bottom: 2px solid #241505aa;
}
.card__banner--empty { background: linear-gradient(120deg, #59421f, #33221280); }
.card__boss {
  position: absolute; top: 14px; right: 6px;
  width: 96px; height: 96px; object-fit: contain;
  filter: drop-shadow(0 6px 6px #000c);
  transition: transform .15s ease;
}
.card:hover .card__boss { transform: scale(1.07) rotate(-2deg); }
.card__body { padding: 12px 14px 14px; padding-right: 66px; min-height: 74px; }
.card__level {
  position: absolute; top: 96px; left: 12px;
  min-width: 44px; height: 44px; padding: 0 6px;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 19px;
  color: #fff; text-shadow: 0 2px 0 #0008;
  background: radial-gradient(circle at 35% 30%, #96ce43, var(--green) 55%, var(--green-dark));
  border: 2px solid #2c4a04;
  border-radius: 50%;
  box-shadow: 0 3px 0 #0007, inset 0 1px 2px #ffffff88;
}
.card__name {
  display: block; margin-top: 12px;
  font-family: var(--font-display); font-weight: 700; font-size: 18px; line-height: 1.15;
  color: var(--ink);
}
.card__name-alt { display: block; font-size: 13px; color: var(--ink-soft); font-style: italic; margin-top: 2px; }
.empty-msg { text-align: center; color: var(--parch); font-size: 18px; margin: 50px 0; }

/* ── dungeon page hero ── */
.dhero {
  position: relative;
  background: var(--banner, linear-gradient(120deg, #59421f, #251808)) center 35%/cover no-repeat;
  border-bottom: 3px solid var(--gold);
  box-shadow: 0 6px 24px #000b;
}
.dhero::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, #140d0788 0%, #140d07d9 78%, #140d07f2 100%);
}
.dhero__inner {
  position: relative; max-width: 1120px; margin: 0 auto;
  display: flex; align-items: flex-end; gap: 26px;
  padding: 60px 20px 26px;
}
.dhero__boss {
  width: 150px; height: 150px; object-fit: contain;
  filter: drop-shadow(0 8px 10px #000e);
  margin-bottom: -4px;
}
.dhero__titles h1 {
  margin: 0;
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(30px, 5vw, 46px);
  color: var(--gold-bright);
  text-shadow: 0 3px 0 #40260a, 0 8px 20px #000;
}
.dhero__alt { margin: 2px 0 0; color: #e5d3ac; font-style: italic; }
.dhero__meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  font: 700 14px var(--font-body);
  color: var(--parch);
  background: #00000080;
  border: 1px solid var(--gold);
  padding: 4px 12px; border-radius: 999px;
  text-shadow: 0 1px 0 #000;
}
.chip--level { background: var(--green-dark); border-color: #2c4a04; }
.chip--pos { font-family: monospace; font-weight: 600; letter-spacing: .5px; }

/* ── article layout ── */
.wrap--article {
  display: grid; grid-template-columns: 300px 1fr; gap: 24px;
  align-items: start; padding-top: 26px;
}
@media (max-width: 900px) { .wrap--article { grid-template-columns: 1fr; } }

.infopanel {
  position: sticky; top: 76px;
  background: linear-gradient(180deg, var(--parch), var(--parch-dark));
  border: 2px solid #241505;
  box-shadow: 0 0 0 2px var(--gold), 0 8px 18px #0009;
  border-radius: 14px;
  padding: 16px;
}
@media (max-width: 900px) { .infopanel { position: static; } }
.infopanel__row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px dashed #b3945c; }
.infopanel__row:last-of-type { border-bottom: 0; }
.infopanel__ico { width: 30px; height: 30px; object-fit: contain; flex: 0 0 30px; font-size: 22px; text-align: center; }
.infopanel__row b { display: block; font-family: var(--font-display); font-size: 15px; }
.infopanel__row span { font-size: 14.5px; color: var(--ink-soft); }
.infopanel__map { margin: 12px 0 0; }
.infopanel__map img { width: 100%; border-radius: 10px; border: 2px solid #241505; cursor: zoom-in; }
.infopanel__map figcaption { font-size: 12.5px; color: var(--ink-soft); text-align: center; margin-top: 4px; }

/* ── toc ── */
.toc { margin-bottom: 16px; }
.toc strong { display: block; font-family: var(--font-display); font-size: 18px; color: var(--boss); margin-bottom: 8px; }
.toc ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.toc a { text-decoration: none; color: var(--ink); font-weight: 600; font-size: 14.5px; transition: color 0.15s; }
.toc a:hover { color: var(--green-dark); }
.infopanel__divider { border: 0; border-top: 1px dashed #b3945c; margin: 16px 0; }

.guide {
  background: linear-gradient(180deg, var(--parch) 0, var(--parch-dark) 100%);
  border: 2px solid #241505;
  box-shadow: 0 0 0 2px var(--gold), 0 10px 24px #000a;
  border-radius: 14px;
  padding: 26px clamp(18px, 4vw, 40px) 34px;
  font-size: 16.5px; line-height: 1.62;
}
.guide__h {
  font-family: var(--font-display); font-weight: 800;
  color: #7a4a10;
  margin: 34px 0 10px;
  padding-bottom: 4px;
  border-bottom: 2px solid #c9ad72;
  scroll-margin-top: 100px;
}
h2.guide__h { font-size: 26px; }
h3.guide__h { font-size: 21px; border-bottom-style: dashed; }
.guide__p { margin: 12px 0; }
.guide__p a { color: var(--green-dark); font-weight: 700; }
.guide__list { margin: 10px 0 16px; padding-left: 26px; }
.guide__list:has(img) {
  display: flex; flex-wrap: wrap; gap: 8px;
  list-style: none; padding: 0; margin: 12px 0 24px;
}
.guide__list:has(img) li {
  display: inline-flex;
}
.monster-pill-link {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(180deg, var(--parch), #dfcd9d);
  border: 1px solid #b3945c;
  border-radius: 20px; padding: 4px 14px 4px 4px;
  font-size: 15px; font-weight: 700; color: var(--ink);
  box-shadow: 0 2px 4px #0000001a, inset 0 1px 0 #ffffff66;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
}
.monster-pill-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px #00000025, inset 0 1px 0 #ffffff66;
  border-color: var(--gold);
}
.monster-pill-link img {
  width: 32px; height: 32px; object-fit: contain;
  background: #fffef7; border-radius: 50%; border: 1px solid #c9ad72;
}
.monster-pill-link img:not([src]), .monster-pill-link img[src=""] { display: none; }
.guide__fig { margin: 18px 0; text-align: center; }
.guide__fig img {
  max-width: 100%; border-radius: 12px;
  border: 2px solid #241505;
  box-shadow: 0 6px 16px #0007;
  cursor: zoom-in;
}
.guide__fig figcaption { font-size: 13.5px; color: var(--ink-soft); margin-top: 6px; }

/* ── monster cards ── */
.mcard {
  background: #fffef7cc;
  border: 2px solid #b3945c;
  border-radius: 12px;
  padding: 14px 16px;
  margin: 16px 0;
  box-shadow: 0 3px 10px #00000022;
  scroll-margin-top: 100px; /* space for topbar */
}
.mcard:target {
  animation: highlight-pulse 1.5s ease-out;
}
@keyframes highlight-pulse {
  0% { box-shadow: 0 0 0 6px var(--gold-bright), 0 10px 24px #0004; border-color: var(--gold-bright); transform: scale(1.02); }
  100% { box-shadow: 0 3px 10px #00000022; transform: scale(1); }
}
.mcard--boss {
  border-color: var(--boss);
  box-shadow: 0 0 0 2px #a8352c55, 0 4px 14px #00000033;
  background: linear-gradient(180deg, #fff3ea, #ffe9dd88), #fffef7;
}
.mcard__head { display: flex; gap: 14px; align-items: center; }
.mcard__img { width: 84px; height: 84px; object-fit: contain; filter: drop-shadow(0 4px 4px #0006); }
.mcard__id h3 { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 21px; }
.mcard__crown { color: var(--boss); }
.mcard__alt { margin: 0; font-style: italic; color: var(--ink-soft); font-size: 13.5px; }
.mcard__lvl { margin: 2px 0 0; font-weight: 700; color: var(--ink-soft); font-size: 14px; }
.mcard__stats, .mcard__resists { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; }
.stat { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 15px; }
.stat--res { font-size: 14px; }
.ico {
  display: inline-block; width: 22px; height: 22px; flex: 0 0 22px;
  background: url("icons/stat-sprite.png") no-repeat;
  background-size: 124px 2048px;
}
.ico--pv { background-position: -94px -315px; }
.ico--pa { background-position: -94px -240px; }
.ico--pm { background-position: -94px -49px; }
.ico--neutral { background-position: -94px -14px; }
.ico--earth { background-position: -94px -432px; }
.ico--fire { background-position: -94px -393px; }
.ico--water { background-position: -94px -86px; }
.ico--air { background-position: -94px -162px; }

.mcard__spells { margin-top: 12px; }
.mcard__spells summary {
  cursor: pointer;
  font: 700 15px var(--font-display);
  color: var(--green-dark);
  user-select: none;
}
.mcard__spells table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 14.5px; }
.mcard__spells th {
  text-align: left; font-family: var(--font-display); font-size: 13px;
  color: var(--ink-soft); border-bottom: 2px solid #c9ad72; padding: 4px 8px;
}
.mcard__spells td { padding: 6px 8px; border-bottom: 1px solid #dcc794; vertical-align: top; }
.spell-name { font-weight: 800; white-space: nowrap; }
.spell-name span { display: block; font-weight: 400; font-style: italic; color: var(--ink-soft); font-size: 12.5px; }
.spell-range { white-space: nowrap; }

/* ── pager ── */
.pager { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 14px; margin-top: 26px; }
.pager__link {
  display: inline-flex; flex-direction: column; gap: 2px;
  text-decoration: none;
  font-family: var(--font-display); font-weight: 700; font-size: 17px;
  color: var(--parch);
  background: #ffffff12; border: 1px solid var(--gold);
  border-radius: 12px; padding: 10px 18px;
}
.pager__link span { font-size: 13px; color: var(--gold-bright); }
.pager__link:hover { background: #ffffff24; }
.pager__link--next { text-align: right; margin-left: auto; }

/* ── lightbox ── */
.lightbox[hidden] { display: none; }
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: #000000e0;
  display: grid; place-items: center;
  padding: 30px;
}
.lightbox img { max-width: 95vw; max-height: 92vh; border-radius: 8px; box-shadow: 0 10px 40px #000; }
.lightbox button {
  position: absolute; top: 14px; right: 18px;
  font-size: 22px; color: #fff; background: none; border: 0; cursor: pointer;
}

/* ── footer ── */
.footer {
  margin-top: 40px; padding: 26px 20px 34px;
  text-align: center; font-size: 13.5px; color: #b9a37c;
  background: #00000066; border-top: 1px solid #ffffff14;
}
.footer a { color: var(--gold-bright); }
