/* EverRun website. The page is a day: dawn at the top (the morning run),
   noon for heroes and battles, golden hour for alliances, night for the
   live boards. Pixel art from the game itself, never redrawn. */

:root {
  --ink: #1d2030;
  --ink-soft: #4a4f63;
  --paper: #fffaf3;
  --line: #ecdcc4;
  --exp: #3d8b33;
  --exp-bright: #7cd36b;
  --gold: #c98a12;
  --gold-bright: #f2c14e;
  --rival: #d9534a;
  --sky-blue: #4f8fd6;
  --night: #121428;
  --night-2: #1d1f3d;
  --night-ink: #ecebf7;
  --night-soft: #a9a8c8;
  --display: "Pixelify Sans", "Courier New", monospace;
  --body: "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --num: "VT323", "Courier New", monospace;
  --radius: 16px;
  --max: 1160px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--body); font-size: 17px; line-height: 1.6; }
img { max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { text-wrap: balance; margin: 0; }
p { margin: 0; }
.wrap { max-width: var(--max); margin: 0 auto; padding-left: max(18px, env(safe-area-inset-left, 0px)); padding-right: max(18px, env(safe-area-inset-right, 0px)); }
.px { image-rendering: pixelated; image-rendering: crisp-edges; }
.num { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid var(--sky-blue); outline-offset: 3px; border-radius: 6px; }

/* ---------- nav ---------- */
.nav { position: sticky; top: 0; z-index: 50; background: #fffaf3e6; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid #ecdcc499; }
.nav .wrap { display: flex; align-items: center; gap: 18px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--display); font-weight: 700; font-size: 22px; flex: none; }
.brand img { width: 34px; height: 34px; border-radius: 9px; }
.nav ul { list-style: none; margin: 0 0 0 auto; padding: 0; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.nav ul::-webkit-scrollbar { display: none; }
.nav li a { display: block; padding: 8px 12px; border-radius: 999px; text-decoration: none; font-weight: 600; font-size: 15px; white-space: nowrap; color: var(--ink-soft); }
.nav li a:hover, .nav li a[aria-current] { background: #1d20300d; color: var(--ink); }
.nav li a.live { color: var(--exp); }
.nav li a.live::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--exp-bright); margin-right: 6px; vertical-align: 2px; box-shadow: 0 0 0 3px #7cd36b40; }
.night-nav .nav { background: #121428e6; border-color: #ffffff14; }
.night-nav .nav .brand, .night-nav .nav li a { color: var(--night-ink); }
.night-nav .nav li a:hover, .night-nav .nav li a[aria-current] { background: #ffffff14; }
@media (max-width: 760px) {
  .nav .wrap { flex-wrap: wrap; gap: 0 12px; padding-block: 8px; }
  .nav ul { margin: 6px 0 0; width: 100%; }
  .brand { font-size: 20px; }
}

/* ---------- sprites ----------
   Strips from the game: square frames, 17 to a strip.
   Hero poses: idle 0-2, attack 3-5, skill 6-8, cheer 9-11, hit 12, down 13, walk 14-16. */
.spr { display: inline-block; width: var(--s, 96px); height: var(--s, 96px); background-image: var(--img); background-repeat: no-repeat; background-size: calc(var(--s, 96px) * 17) var(--s, 96px); image-rendering: pixelated; image-rendering: crisp-edges; flex: none; animation: idle .9s steps(3) infinite; }
.spr.walk { animation: walk .42s steps(3) infinite; }
.spr.atk { animation: atk .55s steps(3) infinite; }
.spr.sk { animation: skill .7s steps(3) infinite; }
.spr.cheer { animation: cheer .7s steps(3) infinite; }
.spr.hit { animation: none; background-position-x: calc(var(--s, 96px) * -12); }
.spr.down { animation: none; background-position-x: calc(var(--s, 96px) * -13); }
.spr.once { animation-iteration-count: 1; animation-fill-mode: forwards; }
.flip { transform: scaleX(-1); }
@keyframes idle { from { background-position-x: 0; } to { background-position-x: calc(var(--s, 96px) * -3); } }
@keyframes atk { from { background-position-x: calc(var(--s, 96px) * -3); } to { background-position-x: calc(var(--s, 96px) * -6); } }
@keyframes skill { from { background-position-x: calc(var(--s, 96px) * -6); } to { background-position-x: calc(var(--s, 96px) * -9); } }
@keyframes cheer { from { background-position-x: calc(var(--s, 96px) * -9); } to { background-position-x: calc(var(--s, 96px) * -12); } }
@keyframes walk { from { background-position-x: calc(var(--s, 96px) * -14); } to { background-position-x: calc(var(--s, 96px) * -17); } }

/* icons: assets/icons.png, 32px, 10 to a row (index set in JS from icons.json order) */
.ic { display: inline-block; width: var(--i, 32px); height: var(--i, 32px); background: url(../assets/icons.png) no-repeat; background-size: calc(var(--i, 32px) * 10) auto; image-rendering: pixelated; vertical-align: middle; flex: none; }
/* game item icons: assets/game_icons.png, 32px, 10 to a row */
.gi { display: inline-block; width: var(--i, 32px); height: var(--i, 32px); background: url(../assets/game_icons.png) no-repeat; background-size: calc(var(--i, 32px) * 10) auto; image-rendering: pixelated; vertical-align: middle; flex: none; }

/* ---------- shared bits ---------- */
.eyebrow { font-family: var(--display); font-size: 14px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); display: inline-flex; align-items: center; gap: 8px; }
.h2 { font-family: var(--display); font-weight: 700; font-size: clamp(32px, 5vw, 52px); line-height: 1.02; letter-spacing: -.01em; }
.lede { font-size: 19px; color: var(--ink-soft); max-width: 60ch; }
.btn { display: inline-flex; align-items: center; gap: 8px; font-family: var(--display); font-weight: 600; font-size: 17px; padding: 13px 20px; border-radius: 12px; text-decoration: none; border: 0; cursor: pointer; transition: transform .12s; }
.btn:hover { transform: translateY(-2px); }
.btn.dark { background: var(--ink); color: #fff; box-shadow: 0 4px 0 #00000033; }
.btn.light { background: #ffffffcc; color: var(--ink); box-shadow: inset 0 0 0 2px #1d203026; }
.btn.green { background: var(--exp-bright); color: #12210f; box-shadow: 0 4px 0 #3f7d33; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: #1d20300d; }
.section { padding-block: clamp(64px, 9vw, 110px); position: relative; }
.head { display: grid; gap: 14px; margin-bottom: 40px; max-width: 760px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(24px, 4vw, 56px); align-items: center; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: grid; gap: 8px; align-content: start; }
.card h3 { font-family: var(--display); font-size: 22px; font-weight: 600; }
.card p { color: var(--ink-soft); font-size: 16px; }
.k { font-family: var(--num); font-size: 30px; line-height: 1; }
.note { font-size: 14px; color: var(--ink-soft); }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } }

/* ---------- day sky bands ---------- */
.dawn { background: linear-gradient(180deg, #ff9a5a 0%, #ffb877 22%, #ffd8a6 52%, #fff1db 82%, var(--paper) 100%); }
.morning { background: linear-gradient(180deg, var(--paper) 0%, #fff4e0 100%); }
.noon { background: linear-gradient(180deg, #dff0ff 0%, #eef7ff 60%, #f6fbff 100%); }
.afternoon { background: linear-gradient(180deg, #f6fbff 0%, #e8f5e1 100%); }
.golden { background: linear-gradient(180deg, #e8f5e1 0%, #ffe3b0 55%, #ffc98a 100%); }
.dusk { background: linear-gradient(180deg, #ffc98a 0%, #e9879a 40%, #6f4f8f 100%); color: #fff; }
.dusk .lede, .dusk .card p { color: #ffffffd9; }
.night { background: linear-gradient(180deg, #6f4f8f 0%, #2a2650 22%, var(--night) 55%); color: var(--night-ink); }
.night .lede { color: var(--night-soft); }
.night.cont { background: var(--night); }
.stars { position: absolute; inset: 0; pointer-events: none; background-image:
  radial-gradient(1.5px 1.5px at 8% 12%, #fff 50%, transparent), radial-gradient(1px 1px at 22% 30%, #fffc 50%, transparent),
  radial-gradient(1.5px 1.5px at 41% 8%, #fff 50%, transparent), radial-gradient(1px 1px at 63% 22%, #fffb 50%, transparent),
  radial-gradient(1.5px 1.5px at 79% 10%, #fff 50%, transparent), radial-gradient(1px 1px at 92% 34%, #fffa 50%, transparent),
  radial-gradient(1px 1px at 52% 40%, #fff9 50%, transparent), radial-gradient(1.5px 1.5px at 33% 52%, #fff9 50%, transparent);
  opacity: .8; }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; padding-top: clamp(40px, 7vw, 80px); }
.hero .sun { position: absolute; width: clamp(160px, 22vw, 260px); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, #fff4b8 0%, #ffe07a 45%, #ffc65a 70%, #ffc65a00 71%); right: 6%; top: 40px; filter: drop-shadow(0 0 60px #ffd36d); animation: rise 4s ease-out both; }
@keyframes rise { from { transform: translateY(80px); opacity: .4; } to { transform: none; opacity: 1; } }
.hero .grid2 { position: relative; align-items: center; }
.hero h1 { font-family: var(--display); font-weight: 700; font-size: clamp(44px, 7.4vw, 92px); line-height: .95; letter-spacing: -.02em; margin: 14px 0 18px; }
.hero h1 span { color: #2f6f2a; }
.hero .lede { color: #3b3f51; }
.hero .ctas { display: flex; gap: 10px; flex-wrap: wrap; margin: 26px 0 16px; }
.needs { display: inline-flex; align-items: center; gap: 10px; background: #ffffffb3; border-radius: 12px; padding: 8px 14px 8px 8px; font-size: 15px; font-weight: 600; }
.needs b { font-family: var(--display); }
.devices { position: relative; min-height: 470px; display: grid; place-items: center; }

/* phone and watch frames (mockups of real screens) */
.phone { width: 270px; background: #14151d; border-radius: 40px; padding: 12px; box-shadow: 0 0 0 2px #2a2c3a, 0 30px 70px #a3581f55; color: #f2f3f7; }
.phone .scr { background: #14151d; border-radius: 30px; overflow: hidden; padding: 16px 14px 18px; display: grid; gap: 10px; min-height: 480px; align-content: start; font-size: 13px; }
.phone .bar { display: flex; justify-content: space-between; font-weight: 700; font-size: 12px; color: #c9cbd8; padding: 0 6px; }
.watch { width: 196px; aspect-ratio: 196 / 236; background: #0b0b0f; border-radius: 52px; padding: 13px; box-shadow: 0 0 0 7px #2a2c33, 0 0 0 9px #4a4d58, 0 24px 50px #0006; color: #fff; position: relative; }
.watch::after { content: ""; position: absolute; right: -14px; top: 64px; width: 8px; height: 40px; border-radius: 4px; background: #4a4d58; }
.watch .scr { height: 100%; border-radius: 40px; background: #000; overflow: hidden; display: grid; align-content: center; justify-items: center; gap: 4px; padding: 12px; text-align: center; }
.app { --pnl: #1f2130; --mut: #9a9db0; }
.app .pnl { background: var(--pnl); border-radius: 12px; padding: 10px 12px; }
.app .mut { color: var(--mut); }
.app .g { color: var(--exp-bright); font-family: var(--display); }
.app .y { color: var(--gold-bright); font-family: var(--display); }
.app .b { color: #6aa6f5; font-family: var(--display); }
.app .lbl { font-family: var(--display); font-size: 11px; letter-spacing: .08em; color: var(--mut); }
.app .big { font-family: var(--num); font-size: 44px; line-height: .9; }
.app .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.app .meter { height: 6px; border-radius: 3px; background: #2c2f42; overflow: hidden; }
.app .meter i { display: block; height: 100%; background: var(--gold-bright); }
.app .meter.g i { background: var(--exp-bright); }
.hero .phone { transform: rotate(-4deg); }
.hero .watch { position: absolute; right: 0; bottom: 6px; transform: rotate(6deg); }
@media (max-width: 860px) {
  .devices { min-height: 0; padding-bottom: 30px; }
  .hero .watch { right: 4%; bottom: -10px; width: 160px; border-radius: 44px; }
}

/* the walking banner: the world scrolls, the party runs */
.banner { position: relative; height: clamp(200px, 26vw, 300px); background-image: url(../assets/world-banner.png); background-repeat: repeat-x; background-size: auto 100%; image-rendering: pixelated; image-rendering: crisp-edges; animation: pan 60s linear infinite; border-top: 4px solid #2f6f2a; border-bottom: 4px solid #2f6f2a; overflow: hidden; }
@keyframes pan { from { background-position-x: 0; } to { background-position-x: calc(clamp(200px, 26vw, 300px) / 192 * -1024); } }
.party { position: absolute; left: 50%; bottom: 10%; transform: translateX(-50%); display: flex; align-items: end; gap: 0; }
.party .spr { transform: scaleX(-1); }
.party .ldr { --s: clamp(130px, 16vw, 190px); }
.party .mem { --s: clamp(110px, 13vw, 160px); margin: 0 -18px; }
.party .tr { --s: clamp(80px, 9vw, 116px); margin: 0 -10px; }
.banner-cap { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); font-family: var(--display); font-size: 14px; background: #1d2030cc; color: #fff; padding: 4px 12px; border-radius: 999px; white-space: nowrap; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding-block: 26px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; gap: 12px; align-items: center; }
.stat .k { font-size: 34px; }
.stat small { display: block; color: var(--ink-soft); font-size: 13px; font-weight: 600; }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- two worlds ---------- */
.trade { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
@media (max-width: 400px) { .trade { grid-template-columns: 1fr; } }
.ex { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.ex .rw .k { color: var(--ink); }
.ex .gw { text-align: right; }
.ex .gw .k { color: var(--exp); }
.ex small { display: block; font-size: 13px; color: var(--ink-soft); font-weight: 600; line-height: 1.3; }
.ex .arrow { font-family: var(--display); color: var(--gold); font-size: 22px; }
.ladder { margin-top: 26px; background: #1d2030; color: #fff; border-radius: var(--radius); padding: 22px; display: grid; gap: 14px; }
.ladder .track { position: relative; height: 54px; }
.ladder .road { position: absolute; left: 0; right: 0; top: 34px; height: 8px; border-radius: 4px; background: repeating-linear-gradient(90deg, #3a3e58 0 14px, #2c2f45 14px 28px); }
.ladder .stop { position: absolute; top: 0; transform: translateX(-50%); text-align: center; font-family: var(--display); font-size: 14px; white-space: nowrap; }
.ladder .stop b { display: block; color: var(--gold-bright); font-size: 18px; }
.ladder .stop::after { content: ""; display: block; width: 14px; height: 14px; margin: 3px auto 0; border-radius: 50%; background: var(--gold-bright); box-shadow: 0 0 0 4px #f2c14e44; }
.ladder .runner { position: absolute; top: -28px; animation: jog 9s linear infinite; }
@keyframes jog { from { left: 0; } to { left: calc(100% - 64px); } }
.ladder p { color: #c8cadb; font-size: 15px; }
@media (max-width: 600px) { .ladder .stop { font-size: 11px; } .ladder .stop b { font-size: 14px; } }

/* ---------- apple watch ---------- */
.watch-row { display: flex; gap: 34px; justify-content: center; flex-wrap: wrap; padding: 10px 0 20px; }
.watch-row figure { margin: 0; display: grid; justify-items: center; gap: 18px; }
.watch-row figcaption { font-family: var(--display); font-size: 16px; text-align: center; max-width: 220px; }
.watch-row figcaption span { display: block; font-family: var(--body); font-size: 14px; color: var(--ink-soft); }
.ring { width: 98px; height: 98px; border-radius: 50%; background: conic-gradient(var(--exp-bright) 0 72%, #2c2f42 72% 100%); display: grid; place-items: center; }
.ring > div { width: 84px; height: 84px; border-radius: 50%; background: #000; display: grid; place-items: center; overflow: hidden; }
.wbtn { background: var(--exp-bright); color: #0e1a0b; border-radius: 999px; font-family: var(--display); font-weight: 700; padding: 6px 0; width: 100%; font-size: 15px; }
.must { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; background: #1d2030; color: #fff; border-radius: var(--radius); padding: 20px 22px; margin-top: 30px; }
.must p { color: #d6d8e6; }
.must b { font-family: var(--display); color: var(--gold-bright); font-size: 20px; display: block; }

/* ---------- loop ---------- */
.loop { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; counter-reset: step; }
.loop .card { position: relative; padding-top: 26px; }
.loop .card::before { counter-increment: step; content: counter(step); position: absolute; top: -14px; left: 18px; width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: #fff; font-family: var(--display); display: grid; place-items: center; }
.loop .art { height: 96px; display: flex; align-items: end; gap: 4px; }
@media (max-width: 900px) { .loop { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .loop { grid-template-columns: 1fr; } }

/* ---------- heroes ---------- */
.classes { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 26px; align-items: start; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tab { font-family: var(--display); font-size: 17px; padding: 9px 16px; border-radius: 12px; border: 2px solid #1d203022; background: #fff; cursor: pointer; display: inline-flex; gap: 8px; align-items: center; }
.tab[aria-selected="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.stage { background: url(../assets/arena.png) center bottom / cover; image-rendering: pixelated; border-radius: var(--radius); min-height: 330px; position: relative; display: grid; place-items: end center; padding-bottom: 26px; border: 4px solid #2f6f2a; overflow: hidden; }
.stage .spr { --s: clamp(160px, 22vw, 220px); }
.poses { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 12px; }
.pose { font-size: 14px; font-weight: 700; border: 0; background: #1d20300f; padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.pose[aria-pressed="true"] { background: var(--ink); color: #fff; }
.looks { display: flex; gap: 8px; justify-content: center; margin-top: 10px; }
.looks button { border: 2px solid transparent; border-radius: 12px; background: #fff; padding: 0; cursor: pointer; }
.looks button[aria-pressed="true"] { border-color: var(--gold); }
.cls h3 { font-family: var(--display); font-size: 34px; }
.cls .role { font-weight: 700; color: var(--gold); }
.skills { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
.skill { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; }
.skill b { font-family: var(--display); font-weight: 600; }
.skill small { grid-column: 2; color: var(--ink-soft); font-size: 13px; line-height: 1.35; }
.skill em { font-style: normal; font-size: 12px; color: var(--gold); font-weight: 700; }
.sets { display: flex; gap: 6px; flex-wrap: wrap; }
.sets span { font-size: 13px; font-weight: 700; background: #1d20300d; padding: 4px 10px; border-radius: 999px; }
@media (max-width: 900px) { .classes { grid-template-columns: 1fr; } .skills { grid-template-columns: 1fr; } }

/* ---------- forts ---------- */
.mapframe { position: relative; border-radius: var(--radius); overflow: hidden; border: 4px solid #2f6f2a; aspect-ratio: 512 / 320; background: url(../assets/world-map.png) center / cover; image-rendering: pixelated; }
.mapframe .pin { position: absolute; width: 8%; transform: translate(-50%, -100%); image-rendering: pixelated; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translate(-50%, -112%); } }
.mapframe .walker { position: absolute; top: 58%; animation: trek 16s linear infinite; --s: 54px; }
@keyframes trek { 0% { left: 6%; } 100% { left: 88%; } }
.tiers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 22px; }
.tier { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 10px; }
.tier header { display: flex; gap: 12px; align-items: center; }
.tier header img { width: 64px; height: 64px; }
.tier h3 { font-family: var(--display); font-size: 26px; }
.tier dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 15px; }
.tier dt { color: var(--ink-soft); }
.tier dd { margin: 0; font-weight: 700; text-align: right; }
.ups { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-top: 18px; }
.up { background: #ffffffb3; border-radius: 12px; padding: 12px; font-size: 15px; }
.up b { font-family: var(--display); display: block; font-size: 17px; }
@media (max-width: 640px) { .tiers { grid-template-columns: 1fr; } }

/* ---------- battle ---------- */
.battle { position: relative; border-radius: var(--radius); overflow: hidden; border: 4px solid #2a2c3a; background: url(../assets/arena.png) center bottom / cover; image-rendering: pixelated; min-height: clamp(320px, 38vw, 420px); }
.battle .side { position: absolute; bottom: 8%; display: flex; align-items: end; gap: 2%; }
.battle .foes { left: 4%; }
.battle .us { right: 4%; }
.battle .unit { position: relative; display: grid; justify-items: center; }
.battle .unit .hp { width: 70%; height: 7px; background: #00000080; border-radius: 4px; overflow: hidden; margin-bottom: 4px; }
.battle .unit .hp i { display: block; height: 100%; width: 100%; background: var(--exp-bright); transition: width .4s; }
.battle .foes .hp i { background: var(--rival); }
.battle .mon { image-rendering: pixelated; height: var(--h, 110px); width: auto; }
.battle .spr { --s: clamp(90px, 11vw, 128px); }
.dmg { position: absolute; top: 10%; left: 50%; font-family: var(--display); font-weight: 700; font-size: 26px; color: #fff; text-shadow: 2px 2px 0 #000, -1px -1px 0 #000; animation: pop 1s ease-out forwards; pointer-events: none; }
.dmg.heal { color: var(--exp-bright); }
@keyframes pop { from { transform: translate(-50%, 10px); opacity: 1; } to { transform: translate(-50%, -40px); opacity: 0; } }
.log { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); background: #101b66e6; border: 3px solid #e6f1ff; border-radius: 8px; color: #fff; font-family: var(--num); font-size: 22px; padding: 4px 14px; white-space: nowrap; max-width: 92%; overflow: hidden; text-overflow: ellipsis; }
.turnbar { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.turnbar span { display: inline-flex; gap: 8px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 6px 12px 6px 6px; font-size: 14px; font-weight: 700; }
@media (max-width: 640px) { .battle .mon { height: calc(var(--h, 110px) * .7); } }

/* duel */
.vs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; background: linear-gradient(90deg, #2b4ea8, #1d2030 48%, #1d2030 52%, #a8322b); border-radius: var(--radius); padding: 26px 18px; color: #fff; }
.vs .team { display: flex; justify-content: center; align-items: end; gap: 0; flex-wrap: wrap; row-gap: 0; }
.vs .team .spr { --s: clamp(58px, 6.4vw, 84px); margin: 0 -12px; }
.vs .mid { font-family: var(--display); font-size: clamp(40px, 7vw, 70px); color: var(--gold-bright); text-shadow: 4px 4px 0 #000; }
.vs .names { grid-column: 1 / -1; display: flex; justify-content: space-between; font-family: var(--display); font-size: 18px; }
.sizes { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.sizes button { font-family: var(--display); font-size: 16px; border: 2px solid #1d203022; background: #fff; border-radius: 10px; padding: 6px 14px; cursor: pointer; }
.sizes button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- army ---------- */
.troops { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.troop { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; justify-items: center; text-align: center; gap: 6px; }
.troop .spr { --s: 112px; }
.troop h3 { font-family: var(--display); font-size: 22px; }
.troop p { font-size: 14px; color: var(--ink-soft); }
.counter { display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap; font-family: var(--display); font-size: 18px; margin-top: 18px; }
.counter i { font-style: normal; color: var(--gold); }
.march { margin-top: 26px; }
@media (max-width: 700px) { .troops { grid-template-columns: 1fr; } }

/* ---------- alliances ---------- */
.hall { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.hall .phone { margin: 0 auto; transform: none; box-shadow: 0 0 0 2px #2a2c3a, 0 30px 60px #6f4f8f55; }
.buffs { display: grid; gap: 10px; }
.buff { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; background: #ffffffd9; border-radius: 12px; padding: 12px 14px; color: var(--ink); }
.buff b { font-family: var(--display); font-size: 18px; display: block; }
.buff small { color: var(--ink-soft); font-size: 14px; }
.buff .cost { font-family: var(--display); color: var(--gold); white-space: nowrap; }
@media (max-width: 860px) { .hall { grid-template-columns: 1fr; } }

/* ---------- quests / achievements ---------- */
.achs { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.ach { background: #ffffff1a; border: 1px solid #ffffff33; border-radius: 12px; padding: 12px; display: grid; gap: 6px; }
.ach b { font-family: var(--display); font-size: 17px; }
.ach small { color: #ffffffcc; font-size: 13px; line-height: 1.35; }
.tiersbar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; }
.tiersbar i { height: 6px; border-radius: 3px; background: #ffffff33; }
.tiersbar i.on:nth-child(1) { background: #c98a5a; }
.tiersbar i.on:nth-child(2) { background: #cfd6e6; }
.tiersbar i.on:nth-child(3) { background: var(--gold-bright); }
.tiersbar i.on:nth-child(4) { background: #c58cff; }
.dusk .phone { box-shadow: 0 0 0 2px #2a2c3a, 0 30px 60px #2a265088; }

/* ---------- health ---------- */
.health { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.health .card { background: #ffffff14; border-color: #ffffff22; color: var(--night-ink); }
.health .card p { color: var(--night-soft); }
.morale { background: #ffffff10; border: 1px solid #ffffff22; border-radius: var(--radius); padding: 18px; margin-top: 18px; }
.morale .bars { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; align-items: end; height: 120px; margin-top: 10px; }
.morale .bars div { background: var(--exp-bright); border-radius: 6px 6px 2px 2px; position: relative; }
.morale .bars div span { position: absolute; bottom: -22px; left: 0; right: 0; text-align: center; font-size: 12px; color: var(--night-soft); }
.morale .bars div.grace { background: var(--gold-bright); }

/* ---------- live ---------- */
.live-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.panel .btn { justify-self: start; }
.panel { background: var(--night-2); border: 1px solid #ffffff14; border-radius: var(--radius); padding: 18px; display: grid; gap: 12px; align-content: start; }
.panel h3 { font-family: var(--display); font-size: 22px; display: flex; gap: 10px; align-items: center; }
.rows { display: grid; gap: 6px; }
.r { display: grid; grid-template-columns: 28px auto 1fr auto; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: #ffffff08; text-decoration: none; color: inherit; }
a.r:hover { background: #ffffff14; }
.r .rank { font-family: var(--display); color: var(--night-soft); text-align: center; }
.r .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.r .val { font-family: var(--num); font-size: 22px; color: var(--gold-bright); }
.r .av { width: 34px; height: 34px; overflow: hidden; display: grid; place-items: center; }
.r .av .spr { --s: 52px; margin-top: -10px; margin-left: -6px; }
.tag { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 22px; padding: 0 6px; border-radius: 6px; font-family: var(--display); font-size: 13px; color: #fff; background: var(--c, #6a6f8a); }
.empty { color: var(--night-soft); font-size: 15px; padding: 10px; }
.night .btn.light { background: #ffffff14; color: #fff; box-shadow: inset 0 0 0 2px #ffffff33; }
@media (max-width: 900px) { .live-grid { grid-template-columns: 1fr; } }

/* ---------- faq + footer ---------- */
.faq { display: grid; gap: 10px; max-width: 820px; }
.faq details { background: #ffffff0d; border: 1px solid #ffffff1a; border-radius: 12px; padding: 14px 18px; }
.faq summary { font-family: var(--display); font-size: 19px; cursor: pointer; }
.faq p { color: var(--night-soft); margin-top: 8px; }
.foot { background: #0b0c1a; color: var(--night-soft); font-size: 14px; padding-block: 36px; }
.foot .wrap { display: flex; gap: 18px; justify-content: space-between; flex-wrap: wrap; align-items: center; }
.foot a { color: var(--night-ink); }

/* ---------- live pages ---------- */
.page { min-height: 100vh; background: var(--night); color: var(--night-ink); }
.page .top { padding-block: 40px 20px; position: relative; overflow: hidden; }
.page h1 { font-family: var(--display); font-size: clamp(36px, 6vw, 60px); line-height: 1; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; margin: 20px 0; }
.seg button { font-family: var(--display); font-size: 16px; border: 0; background: #ffffff12; color: var(--night-ink); border-radius: 10px; padding: 8px 14px; cursor: pointer; display: inline-flex; gap: 8px; align-items: center; }
.seg button[aria-pressed="true"] { background: var(--gold-bright); color: #1d2030; }
.board .r { grid-template-columns: 44px auto 1fr auto auto; padding: 10px 14px; }
.board .r.top3 { background: #f2c14e14; }
.board .rw { font-family: var(--display); font-size: 14px; color: var(--exp-bright); }
.profile { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 24px; align-items: start; }
.profile .stage { min-height: 260px; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.kv div { background: #ffffff0d; border-radius: 12px; padding: 12px; }
.kv b { display: block; font-family: var(--num); font-size: 30px; color: var(--gold-bright); line-height: 1; }
.kv span { font-size: 13px; color: var(--night-soft); }
@media (max-width: 760px) { .profile { grid-template-columns: 1fr; } .board .r { grid-template-columns: 34px auto 1fr auto; } .board .rw { display: none; } }
#map { height: min(72vh, 680px); border-radius: var(--radius); border: 2px solid #ffffff22; background: #1d1f3d; }
.leaflet-container { font-family: var(--body); }
/* The live map looks like the app's: a dark street map with pixel flags
   (forts) and banners (castles), each with a shadow under it. */
.darkmap { background: #1b2233; }
.darkmap .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.9) saturate(.75); }
.darkmap .leaflet-control-attribution { background: #1b2233cc; color: #a9a8c8; }
.darkmap .leaflet-control-attribution a { color: #cfd6ff; }
.fmark { position: relative; display: grid; justify-items: center; }
.fmark img { image-rendering: pixelated; image-rendering: crisp-edges; position: relative; }
.fmark .fl { position: relative; display: block; line-height: 0; }
.fmark .sh { position: absolute; bottom: 3px; left: 22%; width: 56%; height: 9px; border-radius: 50%; background: #00000070; }
.fmark .tag { position: relative; margin-top: -6px; height: 18px; font-size: 11px; min-width: 30px; box-shadow: 0 1px 3px #0008; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; color: var(--night-soft); margin-top: 12px; align-items: center; }
.legend img { width: 24px; height: 24px; image-rendering: pixelated; vertical-align: middle; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* live pages: text on the night background */
.page .lede, .page .note { color: var(--night-soft); }
.page h1 .tag { height: 34px; font-size: 20px; padding: 0 10px; vertical-align: middle; margin-right: 6px; }
.page .r a { color: var(--night-ink); }
.leaflet-popup-content { font-size: 14px; line-height: 1.5; }
.leaflet-popup-content a { color: #2b6fd6; }
