/* Rival Towns — the game's page. Dressed in the era: dark oak and leather, parchment, gilt. */

@font-face { font-family: "Alegreya SC"; src: url("fonts/AlegreyaSC-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Alegreya"; src: url("fonts/Alegreya.ttf") format("truetype"); font-weight: 400 900; font-display: swap; }
@font-face { font-family: "Alegreya"; src: url("fonts/Alegreya-Italic.ttf") format("truetype"); font-style: italic; font-weight: 400 900; font-display: swap; }
@font-face { font-family: "Cinzel"; src: url("fonts/Cinzel.ttf") format("truetype"); font-weight: 400 900; font-display: swap; }

:root {
  --oak-deep: #120b06;
  --oak: #1d130b;
  --oak-lit: #2a1c11;
  --gilt: #d9a441;
  --gilt-hi: #f2c76c;
  --gilt-dim: #9c7432;
  --name: #f4e6c4;
  --rules: #e8dfcc;
  --muted: #c4b597;
  --oxblood: #8e1f1f;
  --oxblood-deep: #5a1410;
  --parch-ink: #2e2216;
  --parch-head: #7a2c14;
  --build: #7fa08a; --upgrade: #a586b0; --attack: #8e1f1f; --defend: #9a9a94; --prepared: #a9b4c6; --event: #7a4e2a;
  --measure: 68rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 4rem; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation: none !important; } }

body {
  margin: 0;
  background-color: var(--oak-deep);
  background-image:
    radial-gradient(ellipse 120% 60% at 50% 0%, rgba(80, 52, 28, 0.35), transparent 70%),
    linear-gradient(180deg, var(--oak) 0%, var(--oak-deep) 100%);
  color: var(--rules);
  font-family: "Alegreya", "Iowan Old Style", Georgia, serif;
  font-size: 1.1875rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--gilt-hi); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--name); }
:focus-visible { outline: 2px solid var(--gilt-hi); outline-offset: 3px; border-radius: 3px; }

.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 1rem; top: -3rem; z-index: 20; background: var(--oxblood); color: var(--name); padding: 0.5rem 1rem; border-radius: 6px; }
.skip:focus { top: 0.75rem; }

h1, h2, h3, h4 { font-family: "Alegreya SC", "Alegreya", Georgia, serif; font-weight: 700; color: var(--name); line-height: 1.12; margin: 0; letter-spacing: 0.01em; }
p { margin: 0 0 1em; }
.fig { font-family: "Cinzel", serif; font-weight: 600; font-variant-numeric: lining-nums; }

/* ---------- the top bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 10;
  background: linear-gradient(180deg, #24170d, #170f08);
  border-bottom: 1px solid rgba(217, 164, 65, 0.45);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}
.bar-in { max-width: 82rem; margin: 0 auto; display: flex; align-items: center; gap: 1.5rem; padding: 0.55rem 1.25rem; }
.bar .mark { display: flex; align-items: center; gap: 0.55rem; font-family: "Alegreya SC", serif; font-weight: 700; color: var(--name); text-decoration: none; font-size: 1.2rem; white-space: nowrap; }
.bar .mark img { width: 30px; height: 30px; border-radius: 6px; }
.bar nav { margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.bar nav::-webkit-scrollbar { display: none; }
.bar ul { list-style: none; display: flex; gap: 1.3rem; margin: 0; padding: 0; }
.bar nav a { font-family: "Alegreya SC", serif; font-weight: 700; font-size: 1rem; color: var(--muted); text-decoration: none; white-space: nowrap; }
.bar nav a:hover { color: var(--gilt-hi); }

/* ---------- the hero ---------- */
.hero {
  position: relative;
  min-height: clamp(36rem, 92vh, 62rem);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  text-align: center;
  padding: clamp(3rem, 9vh, 6.5rem) 1.25rem 5rem;
  background:
    linear-gradient(180deg, rgba(12, 7, 3, 0.62) 0%, rgba(12, 7, 3, 0.18) 34%, rgba(12, 7, 3, 0.05) 55%, rgba(18, 11, 6, 0.75) 86%, var(--oak) 100%),
    url("img/key_art.jpg") center 38% / cover no-repeat;
  isolation: isolate;
}
.hero h1 {
  font-size: clamp(3.4rem, 10vw, 7.6rem);
  color: #f7ebcd;
  text-shadow: 0 3px 0 rgba(40, 22, 8, 0.65), 0 8px 30px rgba(0, 0, 0, 0.6);
  letter-spacing: 0.015em;
}
.hero .tag {
  margin: 0.4rem 0 0;
  font-size: clamp(1.2rem, 2.4vw, 1.7rem);
  color: #f1e5c8;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.85), 0 0 2px rgba(0, 0, 0, 0.9);
}
.hero .pitch {
  max-width: 38rem; margin: 1.4rem auto 0;
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  color: var(--name);
  background: rgba(20, 12, 6, 0.62);
  border: 1px solid rgba(217, 164, 65, 0.35);
  border-radius: 10px;
  padding: 0.9rem 1.3rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.hero .pitch p { margin: 0; }
.hero .platform { display: block; margin-top: 0.55rem; font-family: "Alegreya SC", serif; font-weight: 700; color: var(--gilt-hi); letter-spacing: 0.06em; font-size: 0.95em; }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.9rem; margin-top: 1.6rem; }

.btn {
  display: inline-block;
  font-family: "Alegreya SC", serif; font-weight: 700; font-size: 1.2rem;
  color: var(--name); text-decoration: none;
  padding: 0.1rem 1.1rem 0.2rem;
  border: 16px solid transparent;
  border-image: url("img/ui/button_walnut.png") 16 fill / 16px / 0 stretch;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.45));
  transition: transform 0.15s ease, filter 0.15s ease;
}
.btn.red { border-image-source: url("img/ui/button_red.png"); }
.btn:hover { color: #fff2d0; transform: translateY(-2px); filter: drop-shadow(0 9px 14px rgba(0, 0, 0, 0.5)) brightness(1.08); }
.btn-inner { display: inline-block; padding: 0 0.2rem; }

/* ---------- sections ---------- */
section { padding: clamp(3.5rem, 8vw, 6rem) 1.25rem; }
.wrap { max-width: var(--measure); margin: 0 auto; }
.wide { max-width: 82rem; margin: 0 auto; }
.head { text-align: center; margin: 0 auto clamp(2rem, 4vw, 3rem); max-width: 46rem; }
.kicker { font-family: "Alegreya SC", serif; font-weight: 700; color: var(--gilt); letter-spacing: 0.14em; font-size: 0.95rem; margin: 0 0 0.5rem; }
.head h2 { font-size: clamp(2rem, 4.4vw, 3.1rem); }
.head .lede { margin: 1rem auto 0; color: var(--muted); font-size: 1.2rem; }
.rule { position: relative; height: 1px; width: min(24rem, 70%); margin: 1.4rem auto 0.4rem; background: linear-gradient(90deg, transparent, var(--gilt) 22%, var(--gilt-hi) 50%, var(--gilt) 78%, transparent); }
.rule::before { content: ""; position: absolute; left: 50%; top: 50%; width: 9px; height: 9px; background: var(--gilt-hi); transform: translate(-50%, -50%) rotate(45deg); box-shadow: 0 0 0 3px var(--oak-deep), 0 0 0 4px rgba(217, 164, 65, 0.6); }

.panel {
  border: 18px solid transparent;
  border-image: url("img/ui/panel_leather.png") 18 fill / 18px / 0 stretch;
  padding: 1rem 1.1rem;
  filter: drop-shadow(0 14px 22px rgba(0, 0, 0, 0.45));
}
.parchment {
  border: 16px solid transparent;
  border-image: url("img/ui/panel_parchment.png") 16 fill / 16px / 0 stretch;
  color: var(--parch-ink);
  filter: drop-shadow(0 16px 26px rgba(0, 0, 0, 0.5));
}

figure { margin: 0; }
.shot { border-radius: 10px; overflow: hidden; border: 1px solid rgba(217, 164, 65, 0.55); box-shadow: 0 0 0 4px rgba(20, 12, 6, 0.9), 0 0 0 5px rgba(217, 164, 65, 0.25), 0 20px 40px rgba(0, 0, 0, 0.55); background: #0d0805; }
figcaption { font-style: italic; color: var(--muted); font-size: 1rem; margin-top: 0.8rem; line-height: 1.4; }

/* ---------- the match ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: clamp(2rem, 4vw, 3.5rem); align-items: center; }
.split.flip { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
.prose p { font-size: 1.15rem; }
.prose strong { color: var(--name); font-weight: 700; }
.facts { list-style: none; padding: 0; margin: clamp(2.5rem, 5vw, 3.5rem) auto 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; max-width: 60rem; }
.facts li { text-align: center; padding: 0.4rem 0.3rem; }
.facts .fig { display: block; font-size: clamp(2.2rem, 4vw, 3rem); color: var(--gilt-hi); line-height: 1.1; }
.facts span:last-child { font-family: "Alegreya SC", serif; font-weight: 700; color: var(--name); font-size: 1.05rem; }

/* ---------- ways to win ---------- */
.wins { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1rem, 2.5vw, 1.8rem); }
.win { display: flex; flex-direction: column; align-items: center; text-align: center; }
.win .pic { height: 17.5rem; display: flex; align-items: center; justify-content: center; margin: 0.4rem 0 1.1rem; }
.win .pic .card { width: 12.4rem; }
.win .pic img.glass { height: 11rem; width: auto; filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.6)); }
.win h3 { font-size: 1.5rem; color: var(--gilt-hi); margin-bottom: 0.6rem; }
.win p { font-size: 1.08rem; margin: 0 0 0.6rem; }
.note { max-width: 50rem; margin: 2rem auto 0; text-align: center; color: var(--muted); font-size: 1.08rem; }
.race { max-width: 56rem; margin: clamp(2.5rem, 5vw, 3.5rem) auto 0; }

/* ---------- a turn (the book) ---------- */
.book { position: relative; max-width: 64rem; margin: 2.5rem auto 0; padding: clamp(2.6rem, 5vw, 3.4rem) clamp(1rem, 3.5vw, 2.6rem) clamp(1.4rem, 3vw, 2.2rem); }
.ribbon {
  position: absolute; left: 50%; top: -3.1rem; transform: translateX(-50%);
  width: min(25rem, 82%); aspect-ratio: 662 / 144;
  background: url("img/ui/ribbon_red.png") center / 100% 100% no-repeat;
  display: flex; align-items: center; justify-content: center;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.45));
}
/* the words sit on the ribbon's red front band (15%–67% of the picture's height, between its studded edges),
   not the picture's middle, which is the lower studs */
.ribbon h2 {
  position: absolute; left: 20%; right: 20%; top: 15.5%; height: 51.5%; margin: 0; padding: 0.06em 0 0;
  display: flex; align-items: center; justify-content: center; line-height: 1; white-space: nowrap;
  font-size: clamp(1.4rem, 3vw, 2rem); color: #f7e3bd; text-shadow: 0 2px 2px rgba(60, 8, 4, 0.9);
}
.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.3rem 2.4rem; }
.steps li { counter-increment: step; position: relative; padding-left: 3.6rem; }
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0.1rem; width: 2.6rem; height: 2.6rem; border-radius: 50%;
  display: grid; place-items: center;
  font-family: "Cinzel", serif; font-weight: 700; font-size: 1.25rem; color: #f7e3bd;
  background: radial-gradient(circle at 35% 30%, #b0372a, #6d160f 70%);
  box-shadow: inset 0 0 0 2px rgba(240, 190, 110, 0.55), 0 2px 4px rgba(60, 20, 0, 0.4);
}
.steps h3 { font-size: 1.3rem; color: var(--parch-head); margin-bottom: 0.25rem; }
.steps p { margin: 0; font-size: 1.08rem; line-height: 1.5; }
.aside { margin: 1.8rem 0 0; padding: 0.9rem 1.2rem; background: rgba(122, 76, 30, 0.12); border-left: 3px solid rgba(122, 44, 20, 0.55); border-radius: 4px; font-size: 1.05rem; }
.aside strong { color: var(--parch-head); }
.turn-shot { max-width: 56rem; margin: clamp(2.5rem, 5vw, 3.5rem) auto 0; }

/* ---------- the cards ---------- */
.kinds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1.2rem, 2.5vw, 2rem); }
.kind { padding: 1.1rem 1rem 1.3rem; min-width: 0; }
.kind-head { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.25rem; }
.kind-head img { width: 2.8rem; height: 2.8rem; flex: none; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6)); }
.kind h3 { font-size: 1.55rem; }
.kind-line { color: var(--muted); font-size: 1.02rem; margin: 0 0 1rem; min-height: 3em; line-height: 1.45; }
.kind { border-top: 3px solid var(--k); border-radius: 12px; background: linear-gradient(180deg, rgba(255, 240, 210, 0.035), rgba(0, 0, 0, 0.15)); box-shadow: inset 0 0 0 1px rgba(217, 164, 65, 0.16); }
.k-build { --k: var(--build); } .k-upgrade { --k: var(--upgrade); } .k-attack { --k: #b0322a; } .k-defend { --k: var(--defend); } .k-prepared { --k: var(--prepared); } .k-event { --k: #a8703e; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem; }

/* A card, laid out as the game lays it (cards/ui/card_view.gd, on a 250 × 350 face). */
.card {
  --tint: #16231b; --metal: #7fa08a; --rule: #7fa08a;
  position: relative; container-type: inline-size;
  aspect-ratio: 5 / 7; border-radius: 3.6%/2.6%;
  overflow: hidden; background: var(--tint);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.55), 0 2px 4px rgba(0, 0, 0, 0.5);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  margin: 0;
}
.card:hover { transform: translateY(-6px) rotate(-0.4deg); box-shadow: 0 22px 34px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(242, 199, 108, 0.35); }
.c-build { --tint: #16231b; --metal: #7fa08a; --rule: #7fa08a; }
.c-upgrade { --tint: #24142a; --metal: #a586b0; --rule: #a586b0; }
.c-attack { --tint: #2a1212; --metal: #b8b2a6; --rule: #8e1f1f; }
.c-defend { --tint: #1d2530; --metal: #9a9a94; --rule: #9a9a94; }
.c-prepared { --tint: #101a36; --metal: #a9b4c6; --rule: #a9b4c6; }
.c-event { --tint: #2a2010; --metal: #7a4e2a; --rule: #a8703e; }
.card .art { position: absolute; inset: 0 0 auto 0; width: 100%; height: auto; }
.card .art.short { -webkit-mask-image: linear-gradient(180deg, #000 82%, transparent 100%); mask-image: linear-gradient(180deg, #000 82%, transparent 100%); }
.card .dark {
  position: absolute; left: 0; right: 0; top: 50%; bottom: 0;
  background:
    radial-gradient(ellipse 50% 50% at 50% 31%, rgba(0, 0, 0, 0.42), transparent 100%),
    radial-gradient(ellipse 56% 52% at 50% 70%, rgba(0, 0, 0, 0.55), transparent 100%),
    linear-gradient(180deg, color-mix(in srgb, var(--tint) 0%, transparent), color-mix(in srgb, var(--tint) 50%, transparent) 40%, color-mix(in srgb, var(--tint) 78%, transparent));
}
.card .frame { position: absolute; inset: 0; width: 100%; height: 100%; }
.card .nm {
  margin: 0; font-family: "Alegreya SC", "Alegreya", Georgia, serif; font-weight: 700;
  position: absolute; left: 5%; right: 5%; top: 65.5%;
  text-align: center; font-size: 10cqw; line-height: 1.15; white-space: nowrap;
  color: var(--name);
  text-shadow: 0 0 2cqw rgba(0, 0, 0, 0.9), 0 0.5cqw 1cqw rgba(0, 0, 0, 0.9);
}
.card .nm.long { font-size: 8.4cqw; top: 66.4%; }
.card .line { position: absolute; left: 30%; width: 40%; top: 75.2%; height: 0.6cqw; background: var(--rule); }
.card .rules {
  position: absolute; left: 6%; right: 6%; top: 76%; bottom: 10.4%;
  margin: 0; display: flex; align-items: center; justify-content: center;
  text-align: center; font-size: var(--fs, 6.4cqw); line-height: 1.17; color: var(--rules); text-wrap: balance;
  text-shadow: 0 0 1.6cqw rgba(0, 0, 0, 0.95), 0 0.3cqw 0.8cqw rgba(0, 0, 0, 0.9);
}
.card .foot { position: absolute; left: 0; right: 0; bottom: 0.4%; display: flex; justify-content: center; gap: 1.2cqw; }
.card .foot > * { width: 12.8cqw; height: 12.8cqw; }
.medal { position: relative; display: grid; place-items: center; background: center / contain no-repeat; font-family: "Alegreya SC", serif; font-weight: 700; font-size: 5.4cqw; line-height: 1; padding-top: 0.2cqw; }
.medal.m1 { background-image: url("img/ui/medal_1.webp"); color: #2b1a0c; }
.medal.m2 { background-image: url("img/ui/medal_2.webp"); color: #3c3f45; }
.medal.m3 { background-image: url("img/ui/medal_3.webp"); color: #4a2c00; }
.disc { position: absolute; top: 3.6cqw; width: 18.4cqw; height: 18.4cqw; display: grid; place-items: center; background: center / contain no-repeat; font-family: "Cinzel", serif; font-weight: 700; font-size: 10.4cqw; line-height: 1; padding-top: 0.6cqw; }
.disc.coin { left: 3.6cqw; background-image: url("img/ui/coin.webp"); color: #3b2a08; }
.disc.men { right: 3.6cqw; background-image: url("img/ui/men.webp"); color: #f2efe8; text-shadow: 0 0 1cqw rgba(0, 0, 0, 0.8); }

/* the special cards: the whole card a painting, a name plate, small costs top right; on the page their rules stand risen, as when read */
.card.special .art { height: 100%; object-fit: cover; }
.card.special .dark {
  top: 46%;
  background: linear-gradient(180deg, transparent 0%, color-mix(in srgb, var(--tint) 92%, transparent) 26%, color-mix(in srgb, var(--tint) 92%, transparent));
}
.card.special .disc { top: 4cqw; width: 12cqw; height: 12cqw; font-size: 6.8cqw; }
.card.special .disc.coin { left: auto; right: 17.6cqw; }
.card.special .disc.men { right: 4.4cqw; }
.card.special .medal-top { position: absolute; left: 4cqw; top: 3.6cqw; width: 12cqw; height: 12cqw; font-size: 5cqw; }
.card.special .rules { top: 59%; bottom: 20%; left: 9%; right: 9%; }
.card.special .nm {
  top: auto; bottom: 5.5%; left: 50%; right: auto; transform: translateX(-50%);
  font-size: 8.2cqw; padding: 0.4cqw 4.8cqw 0.9cqw;
  background: rgba(20, 15, 10, 0.86); border: 1px solid var(--metal); border-radius: 2.8cqw;
  color: #f6e7c2; text-shadow: none; max-width: 90%;
}
.card.special .tick { position: absolute; background: var(--metal); }
.card.special .tick.a { right: 3.6cqw; bottom: 3.6cqw; width: 9.6cqw; height: 0.8cqw; }
.card.special .tick.b { right: 3.6cqw; bottom: 3.6cqw; width: 0.8cqw; height: 9.6cqw; }
.card.special::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 226, 150, 0.0) 40%, rgba(255, 226, 150, 0.28) 50%, rgba(255, 226, 150, 0) 60%, transparent 70%) -120% 0 / 250% 100% no-repeat;
  box-shadow: inset 0 0 0 1px rgba(242, 199, 108, 0.55);
  border-radius: inherit;
  transition: background-position 0.9s ease;
}
.card.special:hover::after { background-position: 220% 0; }

.tiers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.2rem; margin: clamp(2.5rem, 5vw, 3.5rem) auto 0; max-width: 60rem; }
.tier { display: flex; gap: 0.9rem; align-items: center; }
.tier .medal { flex: none; width: 3.6rem; height: 3.6rem; font-size: 1.35rem; }
.tier h3 { font-size: 1.25rem; margin-bottom: 0.15rem; }
.tier p { margin: 0; font-size: 1.02rem; color: var(--muted); line-height: 1.4; }

.realms { margin-top: clamp(3rem, 6vw, 4.5rem); display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.6fr); gap: clamp(1.5rem, 3vw, 2.5rem); align-items: center; }
.realms h3 { font-size: 1.8rem; margin-bottom: 0.7rem; }
.realms p { max-width: 40rem; }
.realms .quad { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.8rem; }

/* ---------- the lords ---------- */
.lords { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(0.9rem, 2vw, 1.4rem); }
.lord { display: flex; flex-direction: column; background: #1a120b; border: 1px solid rgba(217, 164, 65, 0.6); border-radius: 8px; overflow: hidden; box-shadow: 0 0 0 3px #120b06, 0 0 0 4px rgba(217, 164, 65, 0.22), 0 18px 32px rgba(0, 0, 0, 0.5); }
.lord img { aspect-ratio: 3 / 3.3; object-fit: cover; object-position: center 18%; width: 100%; }
.lord .txt { padding: 0.9rem 1rem 1.1rem; text-align: center; flex: 1; background: linear-gradient(180deg, #24180e, #170f09); }
.lord h3 { font-size: 1.5rem; }
.lord .style { color: var(--gilt-hi); font-size: 1.04rem; margin: 0.25rem 0 0.7rem; line-height: 1.35; }
.lord .deck { font-size: 0.98rem; color: var(--muted); margin: 0; line-height: 1.45; }
.lord .deck b { font-family: "Alegreya SC", serif; color: var(--name); font-weight: 700; }
.levels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem; max-width: 48rem; margin: 2.4rem auto 0; }
.levels div { text-align: center; padding: 0.8rem 1rem; }
.levels h3 { font-size: 1.35rem; color: var(--gilt-hi); }
.levels p { margin: 0.3rem 0 0; font-size: 1.04rem; }

/* ---------- decks and packs ---------- */
.parts { margin: 0; }
.parts > div { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 0.2rem 1rem; padding: 0.6rem 0; border-bottom: 1px solid rgba(122, 44, 20, 0.22); }
.parts dt { font-family: "Alegreya SC", serif; font-weight: 700; color: var(--parch-head); font-size: 1.08rem; }
.parts dd { margin: 0; font-size: 1.05rem; line-height: 1.45; }
.deck-sheet { padding: 1.4rem 1.5rem 1.2rem; }
.deck-sheet h3 { color: var(--parch-head); font-size: 1.5rem; margin-bottom: 0.7rem; }
.deck-sheet p { font-size: 1.05rem; }
.packs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.2rem; margin-top: clamp(3rem, 6vw, 4rem); }
.pack {
  text-align: center; padding: 1.4rem 1.1rem 1.3rem;
  border: 16px solid transparent;
  border-image: url("img/ui/panel_cloth.png") 16 fill / 16px / 0 stretch;
}
.pack img { width: 9.5rem; height: 8.6rem; object-fit: contain; margin: 0 auto 0.6rem; filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.55)); }
.pack h3 { font-size: 1.45rem; }
.pack .holds { margin: 0.35rem 0 0.6rem; font-size: 1.02rem; color: var(--name); }
.pack .earn { margin: 0; color: var(--gilt-hi); font-family: "Alegreya SC", serif; font-weight: 700; font-size: 1rem; }
.feats-marks { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: clamp(1.4rem, 3vw, 2.4rem); margin-top: clamp(2.5rem, 5vw, 3.5rem); align-items: start; }
.feats { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem 1.2rem; }
.feats li { padding-left: 1.7rem; position: relative; font-size: 1.02rem; line-height: 1.35; }
.feats li::before { content: ""; position: absolute; left: 0; top: 0.12rem; width: 1.1rem; height: 1.1rem; background: url("img/ui/seal_gold.webp") center / contain no-repeat; }
.feats b { display: block; font-family: "Alegreya SC", serif; color: var(--name); }
.sub { font-size: 1.5rem; margin-bottom: 0.4rem; }
.sub-line { color: var(--muted); margin-bottom: 1rem; font-size: 1.05rem; }
.marks { padding: 1.2rem 1.3rem; }
.marks table { width: 100%; border-collapse: collapse; margin-top: 0.4rem; }
.marks th, .marks td { padding: 0.4rem 0.4rem; border-bottom: 1px solid rgba(217, 164, 65, 0.2); text-align: center; }
.marks th:first-child, .marks td:first-child { text-align: left; }
.marks thead th { font-family: "Alegreya SC", serif; color: var(--gilt-hi); font-size: 0.98rem; }
.marks td { font-family: "Cinzel", serif; font-weight: 600; }
.marks td:first-child { font-family: "Alegreya SC", serif; font-weight: 700; color: var(--name); }
.packs-shots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem; margin-top: clamp(2.5rem, 5vw, 3.5rem); }

/* ---------- fair decks ---------- */
.meter { margin: 2.2rem 0 0.5rem; padding: 2.6rem 0.4rem 3.4rem; position: relative; }
.meter .scale { position: relative; height: 0.9rem; border-radius: 0.45rem; background: linear-gradient(90deg, #3a2a1a, #5b4326); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(217, 164, 65, 0.45); }
.meter .band { position: absolute; top: 0; bottom: 0; left: 40%; width: 22.5%; background: rgba(217, 164, 65, 0.75); }
.meter .over { position: absolute; top: 0; bottom: 0; left: 65%; right: 0; border-radius: 0 0.45rem 0.45rem 0; background: repeating-linear-gradient(135deg, #8e1f1f 0 6px, #5a1410 6px 12px); }
.meter .mk { position: absolute; transform: translateX(-50%); white-space: nowrap; font-size: 0.98rem; line-height: 1.25; text-align: center; }
.meter .mk.up { bottom: calc(100% + 0.5rem); }
.meter .mk.down { top: calc(100% + 0.5rem); }
.meter .mk b { font-family: "Alegreya SC", serif; color: var(--name); display: block; }
.meter .pin { position: absolute; top: -0.45rem; bottom: -0.45rem; width: 3px; transform: translateX(-50%); background: var(--name); border-radius: 2px; }
.meter .pin.cap { background: #e0574a; width: 3px; }
.meter .ends { display: flex; justify-content: space-between; font-family: "Cinzel", serif; font-size: 0.85rem; color: var(--muted); margin-top: 0.35rem; }
.legend-red { color: #f08a7e; }

/* ---------- pictures ---------- */
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(1.4rem, 3vw, 2.4rem); }
.gallery a { display: block; }
.gallery a:hover .shot { box-shadow: 0 0 0 4px rgba(20, 12, 6, 0.9), 0 0 0 5px rgba(242, 199, 108, 0.6), 0 24px 44px rgba(0, 0, 0, 0.6); }

/* ---------- the close ---------- */
.close {
  text-align: center; padding: clamp(6rem, 16vw, 11rem) 1.25rem clamp(4rem, 9vw, 6rem);
  background:
    linear-gradient(180deg, var(--oak-deep) 0%, rgba(18, 11, 6, 0.35) 30%, rgba(18, 11, 6, 0.45) 70%, var(--oak-deep) 100%),
    url("img/victory.jpg") center 30% / cover no-repeat;
}
.close h2 { font-size: clamp(2.2rem, 5vw, 3.6rem); text-shadow: 0 3px 16px rgba(0, 0, 0, 0.85); }
.close p { margin: 0.9rem auto 0; max-width: 34rem; font-size: 1.25rem; color: var(--name); text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9); }
.close .seal { width: 5rem; margin: 1.6rem auto 0; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.6)); }

footer { border-top: 1px solid rgba(217, 164, 65, 0.35); background: #0d0804; padding: 2.4rem 1.25rem 2.8rem; }
.foot-in { max-width: 82rem; margin: 0 auto; display: flex; gap: 1.6rem; align-items: center; }
.foot-in img { width: 3.2rem; flex: none; }
.foot-in p { margin: 0; font-size: 0.98rem; color: var(--muted); }
.foot-in .name { font-family: "Alegreya SC", serif; font-weight: 700; color: var(--name); font-size: 1.25rem; }

/* ---------- narrower screens ---------- */
@media (max-width: 1060px) {
  .kinds { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .realms { grid-template-columns: minmax(0, 1fr); }
  .decks-split { grid-template-columns: minmax(0, 1fr); max-width: 46rem; margin: 0 auto; }
}
@media (max-width: 800px) {
  .lords { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 40rem; margin: 0 auto; }
}
@media (max-width: 860px) {
  .split, .split.flip, .feats-marks { grid-template-columns: minmax(0, 1fr); }
  .wins { grid-template-columns: minmax(0, 1fr); max-width: 30rem; margin: 0 auto; }
  .steps { grid-template-columns: minmax(0, 1fr); }
  .packs { grid-template-columns: minmax(0, 1fr); max-width: 26rem; margin-left: auto; margin-right: auto; }
  .tiers { grid-template-columns: minmax(0, 1fr); max-width: 28rem; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gallery { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  body { font-size: 1.08rem; }
  .bar nav { display: none; }
  .kinds { grid-template-columns: minmax(0, 1fr); }
  .lords { grid-template-columns: minmax(0, 1fr); max-width: 22rem; }
  .kind { max-width: 28rem; margin: 0 auto; width: 100%; }
  .pair, .realms .quad {
    display: grid; grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 14.5rem;
    overflow-x: auto; scroll-snap-type: x mandatory; padding: 0.4rem 0.2rem 1rem; margin: 0 -0.2rem;
    scrollbar-width: thin; scrollbar-color: var(--gilt-dim) transparent;
  }
  .pair > .card, .realms .quad > .card { scroll-snap-align: start; }
  .card:hover { transform: none; }
  .hero { background-position: center, 16% 38%; }
  .packs-shots, .levels { grid-template-columns: minmax(0, 1fr); }
  .feats { grid-template-columns: minmax(0, 1fr); }
  .meter .mk { font-size: 0.85rem; }
  .meter .mk.hide-sm { display: none; }
  .foot-in { flex-direction: column; text-align: center; }
  .parts > div { grid-template-columns: minmax(0, 1fr); }
}
.meter-title { text-align: center; font-family: "Alegreya SC", serif; font-weight: 700; color: var(--gilt); letter-spacing: 0.08em; margin: clamp(2.5rem, 5vw, 3.5rem) 0 0; }
.meter { margin-top: 1rem; }
.meter .mk.r { transform: translateX(-100%); text-align: right; }
.meter .mk.l { transform: none; text-align: left; }
@media (max-width: 640px) { .lord img { aspect-ratio: 4 / 3.6; } }
.gallery .shot { width: 100%; aspect-ratio: 16 / 10.4; object-fit: cover; object-position: center top; }

/* ---------- a picture opened large (CSS :target, no scripts) ---------- */
.viewer { display: none; position: fixed; inset: 0; z-index: 100; align-items: center; justify-content: center; padding: clamp(3.6rem, 7vh, 5rem) clamp(0.6rem, 5vw, 4.5rem) clamp(1rem, 3vh, 2rem); }
.viewer:target { display: flex; }
.viewer-shade { position: absolute; inset: 0; background: rgba(12, 7, 4, 0.92); cursor: zoom-out; }
.viewer-frame { position: relative; margin: 0; max-width: 100%; max-height: 100%; display: flex; flex-direction: column; align-items: center; gap: 0.8rem; }
.viewer-frame img { display: block; max-width: 100%; max-height: calc(100vh - 11rem); width: auto; height: auto; border-radius: 6px;
  box-shadow: 0 0 0 3px rgba(20, 12, 6, 0.95), 0 0 0 4px rgba(242, 199, 108, 0.55), 0 30px 60px rgba(0, 0, 0, 0.7); }
.viewer-frame figcaption { max-width: 52rem; text-align: center; color: #e9d6b2; font-style: italic; font-size: 1.05rem; line-height: 1.4; }
.viewer-count { font-style: normal; font-family: "Alegreya SC", serif; color: var(--gilt-hi); margin-right: 0.4rem; }
.viewer-close { position: absolute; top: clamp(0.7rem, 2vh, 1.2rem); right: clamp(0.7rem, 2vw, 1.4rem); z-index: 2;
  min-width: 7.5rem; padding: 0.55rem 1.4rem 0.7rem; text-align: center; text-decoration: none;
  font-family: "Alegreya SC", serif; font-weight: 700; font-size: 1.15rem; color: #f7e3bd; text-shadow: 0 2px 2px rgba(60, 8, 4, 0.9);
  background: url("img/ui/button_red.png") center / 100% 100% no-repeat; }
.viewer-close::after { content: " \2715"; font-size: 0.85em; }
.viewer-step { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 3.2rem; height: 3.2rem; border-radius: 50%;
  display: grid; place-items: center; text-decoration: none; font-size: 2.4rem; line-height: 1; padding-bottom: 0.25rem;
  color: #f7e3bd; background: rgba(40, 22, 12, 0.85); box-shadow: 0 0 0 2px rgba(242, 199, 108, 0.55); }
.viewer-prev { left: clamp(0.3rem, 1.2vw, 1.2rem); }
.viewer-next { right: clamp(0.3rem, 1.2vw, 1.2rem); }
.viewer-close:hover, .viewer-step:hover, .viewer-close:focus-visible, .viewer-step:focus-visible { filter: brightness(1.15); outline: none; }
@media (max-width: 640px) {
  .viewer-step { top: auto; bottom: 0.8rem; transform: none; width: 2.8rem; height: 2.8rem; font-size: 2rem; }
  .viewer-frame img { max-height: calc(100vh - 13rem); }
}
