/* =====================================================================
   ERGO page styles  (public/css/ergo.css)
   Loaded after /css/site.css on /ergo/ only. Nudges the shared tokens to
   Ergo's own ENDESGA 32 palette: ink-night background (#181425), slate
   panels, cream text, the blood moon (#ff0044) and moon silver (#c0cbdc).

   PIXEL ART: Ergo's art is tiny (cards 64x48, backgrounds 180x300, icons
   16x16). The @3x / @4x files are nearest-neighbour upscales, so any size
   that is a whole multiple of the BASE size stays crisp with
   image-rendering: pixelated. Fluid sizes use smooth sampling instead.

   RELEASE STATUS: Ergo is live (launched 2026-11-26, v0.2.0); <body> has
   data-status="live". .is-soon-only / .is-live-only live in site.css.
   ===================================================================== */

body.page-ergo {
  --bg: #181425;
  --bg-2: #262b44;
  --panel: #1e1a31;
  --panel-2: #3a4466;
  --edge: #0b0912;
  --muted: #c0cbdc;
  --gold: #feae34;
  --cream: #ead4aa;
  --night: #262b44;
  --steel: #5a6988;
  --accept: #63c74d;
  --refuse: #e43b44;
  --wine: #a22633;
  background:
    radial-gradient(circle at 82% 6%, rgba(255, 0, 68, .16), transparent 32%) fixed,
    radial-gradient(ellipse at 50% 0%, var(--bg-2), var(--bg) 70%) fixed, var(--bg);
}

/* ---------- title screen ---------- */
.eg-hero { padding: 24px 0 64px; border-bottom: 4px solid var(--edge); position: relative; overflow: hidden; }
.eg-hero::after { /* purple hills like the game's menu backdrop */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 10px;
  background: repeating-linear-gradient(90deg, #68386c 0 8px, #3e2731 8px 16px);
}
.eg-hero .hud { margin-bottom: 32px; }
.eg-hero .hud b { color: var(--cream); }
.eg-hero .hud .eg-red { color: var(--blood); }
.eg-hero__grid { display: grid; gap: 40px; align-items: center; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
@media (max-width: 860px) { .eg-hero__grid { grid-template-columns: minmax(0, 1fr); gap: 36px; } }
.eg-hero__text { text-align: center; }
.eg-logo { margin: 0 auto; }
/* logo art is 100x28 at 4x: show it at 3x, 4x or 6x so every pixel stays square */
.eg-logo img { width: 300px; height: auto; margin: 0 auto; image-rendering: pixelated; filter: drop-shadow(4px 4px 0 var(--edge)); }
@media (min-width: 480px) { .eg-logo img { width: 400px; } }
@media (min-width: 1080px) { .eg-logo img { width: 600px; } }
.js .eg-logo img { animation: eg-drop .7s steps(7) both; }
@keyframes eg-drop { from { transform: translateY(-80px); opacity: 0; } 70% { transform: translateY(6px); opacity: 1; } }
.eg-hero .eyebrow { margin: 22px 0 0; color: var(--cream); }
.eg-hero__lead { font-size: clamp(22px, 2.8vw, 28px); margin: 14px auto 0; max-width: 32ch; }
.eg-hero__lead .accent { color: var(--blood); }
.eg-hero__status { margin-top: 26px; }
.eg-hero__actions { justify-content: center; margin-top: 26px; }
.eg-hero__perks { justify-content: center; margin-top: 18px; }

/* phone-shaped frame, like Ergo's own desktop wrapper */
.eg-phone { margin: 0; display: grid; justify-items: center; }
.eg-phone__body {
  width: max-content; max-width: 100%; position: relative; background: var(--edge); padding: 12px 10px 18px;
  border: 4px solid #3a4466; border-radius: 28px; box-shadow: var(--shadow-lg);
}
.eg-phone__body::before { /* speaker slot */
  content: ""; display: block; width: 48px; height: 6px; margin: 0 auto 10px; background: #3a4466; border-radius: 3px;
}
.eg-phone__screen { position: relative; overflow: hidden; border-radius: 10px; border: 3px solid #262b44; }
/* menu art is 180x300 (file is @3x). 270 = 1.5x (smooth), 360 = 2x (crisp) */
.eg-phone__screen > img { width: 270px; height: auto; }
@media (min-width: 420px) { .eg-phone__screen > img { width: 360px; image-rendering: pixelated; } }
.eg-phone__card {
  position: absolute; left: 50%; top: 54%; width: 108px; transform: translate(-50%, -50%) rotate(-6deg);
  filter: drop-shadow(4px 4px 0 rgba(11, 9, 18, .85));
}
.eg-phone__card img { width: 100%; height: auto; }
@media (min-width: 420px) { .eg-phone__card { width: 144px; } .eg-phone__card img { image-rendering: pixelated; } }
.js .eg-phone__card { animation: eg-sway 3.2s steps(4) infinite; }
@keyframes eg-sway { 0%, 100% { transform: translate(-50%, -50%) rotate(-6deg); } 50% { transform: translate(-46%, -52%) rotate(4deg); } }
.eg-phone__tag {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); white-space: nowrap;
  font-family: var(--font-pixel); font-size: 10px; letter-spacing: 1px; color: var(--cream);
  background: rgba(11, 9, 18, .85); border: 2px solid var(--blood); padding: 7px 9px;
}
.eg-phone figcaption { text-align: center; font-size: 19px; color: var(--muted); margin-top: 12px; max-width: 34ch; }

/* ---------- story ---------- */
.eg-story { display: grid; gap: 40px; align-items: center; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
@media (max-width: 860px) { .eg-story { grid-template-columns: minmax(0, 1fr); } }
.eg-story__text p { font-size: 24px; }
.eg-quote { font-family: var(--font-pixel); font-size: 12px; line-height: 1.9; color: var(--cream); border-left: 4px solid var(--c); padding-left: 14px; }
.eg-story__text .eg-quote p { font-size: inherit; }
.eg-quote cite { display: block; font-style: normal; color: var(--muted); margin-top: 6px; font-size: 10px; }
/* a card in the game's style: card art in a navy and gold frame */
.eg-cardframe {
  background: var(--night); border: 4px solid var(--edge);
  box-shadow: inset 0 0 0 3px var(--gold), inset 0 0 0 6px #733e39, var(--shadow-lg);
  padding: 14px 14px 12px; text-align: center; max-width: 292px; margin: 0 auto;
}
.eg-cardframe img { width: 256px; height: auto; margin: 0 auto; image-rendering: pixelated; border: 2px solid var(--edge); }
.eg-cardframe figcaption { font-size: 20px; color: var(--cream); margin-top: 10px; }
.eg-cardframe figcaption b { display: block; font-family: var(--font-pixel); font-size: 10px; font-weight: normal; color: var(--gold); letter-spacing: 1px; margin-bottom: 6px; }
@media (max-width: 340px) { .eg-cardframe img { width: 128px; } }

.eg-shards { list-style: none; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-top: 40px; }
.eg-shards li { background: var(--edge); border: 3px solid var(--panel-2); text-align: center; padding: 12px 4px 10px; position: relative; }
.eg-shards li + li::before { /* path between the pieces */
  content: "\25B6"; position: absolute; left: -11px; top: 38px; font-size: 10px; color: var(--muted);
}
.eg-shards img { width: 64px; height: 64px; margin: 0 auto; image-rendering: pixelated; }
.eg-shards b { display: block; font-family: var(--font-pixel); font-size: 9px; font-weight: normal; color: var(--cream); margin-top: 8px; line-height: 1.5; letter-spacing: 1px; }
.eg-shards span { display: block; font-size: 18px; color: var(--muted); line-height: 1.1; margin-top: 2px; }
.eg-shards li:last-child { border-color: var(--cyan); }
@media (max-width: 560px) {
  .eg-shards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .eg-shards img { width: 48px; height: 48px; } /* 3x */
  .eg-shards li + li::before { display: none; }
}
.eg-numbers { margin-top: 32px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .eg-numbers { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ---------- features ---------- */
/* unlockable pets: 16px art at 3x */
.eg-pets { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.eg-pets img { width: 48px; height: 48px; image-rendering: pixelated; }
.eg-features .feature__icon img { width: 48px; height: 48px; image-rendering: pixelated; }

/* ---------- heroes ---------- */
.eg-heroes { list-style: none; display: grid; gap: 22px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.eg-hero-card { display: flex; flex-direction: column; background: var(--panel); border: 4px solid var(--edge); box-shadow: inset 0 0 0 3px var(--c), var(--shadow-lg); }
.eg-hero-card__portrait {
  display: grid; place-items: center; padding: 16px 0 12px; border-bottom: 4px solid var(--edge);
  background: repeating-conic-gradient(var(--bg-2) 0 25%, #2c2f4c 0 50%) 0 0 / 16px 16px;
}
/* portraits are 32px art at 4x: 96 = 3x */
.eg-hero-card__portrait img { width: 96px; height: 96px; image-rendering: pixelated; }
.eg-hero-card:hover .eg-hero-card__portrait img { animation: eg-hop .6s steps(2) infinite; }
@keyframes eg-hop { 50% { transform: translateY(-4px); } }
.eg-hero-card__body { padding: 16px 18px 20px; flex: 1; }
.eg-hero-card__name { font-family: var(--font-pixel); font-size: 13px; color: var(--c); display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; line-height: 1.5; }
.eg-role { font-family: var(--font-pixel); font-size: 9px; color: var(--ink); background: var(--panel-2); border: 2px solid var(--edge); padding: 4px 6px; }
.eg-hero-card__who { color: var(--cream); font-size: 20px; margin-top: 4px; }
.eg-hero-card__body p { color: var(--muted); margin-top: 8px; font-size: 20px; }
.eg-perk { display: block; margin-top: 12px; font-size: 20px; color: var(--ink); border-top: 2px dashed var(--panel-2); padding-top: 10px; }
.eg-perk b { font-family: var(--font-pixel); font-size: 10px; font-weight: normal; color: var(--c); letter-spacing: 1px; margin-right: 6px; }
.eg-start { display: block; font-size: 19px; color: var(--muted); margin-top: 6px; }
.eg-heroes > li:nth-child(1) { --c: #0099db; }
.eg-heroes > li:nth-child(2) { --c: var(--accept); }
.eg-heroes > li:nth-child(3) { --c: #b55088; }
.eg-heroes > li:nth-child(4) { --c: var(--refuse); }
.eg-heroes > li:nth-child(5) { --c: #f77622; }
.eg-heroes > li:nth-child(6) { --c: #e4a672; }
.eg-heroes > li:nth-child(7) { --c: var(--cream); }
.eg-hero-card--locked { border-style: dashed; }
.eg-unlock { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; font-family: var(--font-pixel); font-size: 9px; letter-spacing: 1px; color: var(--cream); }
.eg-unlock .lock { width: 10px; height: 12px; }

.eg-cast { margin-top: 32px; }
.eg-cast .panel { display: grid; gap: 16px; align-content: start; }
.eg-cast__art { display: grid; place-items: center; height: 156px; background: var(--edge); border: 3px solid var(--panel-2); }
.eg-cast__art img { image-rendering: pixelated; }
.eg-cast h3 { font-family: var(--font-pixel); font-size: 12px; color: var(--c); line-height: 1.5; margin-bottom: 8px; }
.eg-cast p { color: var(--muted); font-size: 20px; }

/* ---------- the journey: 5 acts, 10 regions ---------- */
.eg-acts { list-style: none; display: grid; gap: 22px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .eg-acts { grid-template-columns: repeat(2, minmax(0, 1fr)); } .eg-act--final { grid-column: span 2; } }
@media (min-width: 1000px) { .eg-acts { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.eg-act { background: var(--panel); border: 4px solid var(--edge); box-shadow: inset 0 0 0 3px var(--c), var(--shadow-lg); padding: 16px; }
.eg-act h3 { font-family: var(--font-pixel); font-size: 11px; color: var(--cream); line-height: 1.6; letter-spacing: 1px; margin-bottom: 12px; }
.eg-act h3 b { display: block; color: var(--c); font-weight: normal; font-size: 10px; }
.eg-act__regions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.eg-act figure { background: var(--edge); border: 2px solid var(--panel-2); padding: 3px; }
.eg-act img { width: 100%; aspect-ratio: 180 / 300; object-fit: cover; }
.eg-act figcaption { font-size: 18px; color: var(--muted); padding: 6px 4px 2px; line-height: 1.1; }
.eg-act--final { --c: var(--blood); }
.eg-act--final .eg-act__wrap { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .eg-act--final .eg-act__wrap { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; } }
.eg-boss { text-align: center; }
.eg-boss img { width: 128px; height: 128px; margin: 0 auto; image-rendering: pixelated; filter: drop-shadow(0 0 12px rgba(255, 0, 68, .55)); }
@media (min-width: 1000px) { .eg-boss img { width: 192px; height: 192px; } }
.eg-boss p { color: var(--muted); font-size: 20px; margin-top: 10px; }
.eg-boss b { display: block; font-family: var(--font-pixel); font-weight: normal; font-size: 11px; color: var(--blood); letter-spacing: 1px; margin-top: 12px; }
.eg-hazards { margin-top: 32px; }
.eg-hazards .chips { justify-content: center; margin-top: 14px; }

/* ---------- how to play ---------- */
.eg-steps { list-style: none; counter-reset: step; }
.eg-steps li { counter-increment: step; position: relative; background: var(--panel); border: 4px solid var(--edge); box-shadow: var(--shadow-lg); padding: 52px 20px 20px; }
.eg-steps li::before {
  content: "STEP " counter(step); position: absolute; left: -4px; top: -4px;
  font-family: var(--font-pixel); font-size: 10px; letter-spacing: 1px;
  background: var(--c); color: var(--c-ink); border: 3px solid var(--edge); padding: 8px 10px;
}
.eg-steps li:last-child::before { content: "STEP " counter(step) " \2605"; }
.eg-steps p { color: var(--muted); }
.eg-steps strong { color: var(--ink); font-weight: normal; }
.eg-keys kbd, .eg-demo kbd { font-family: var(--font-pixel); font-size: 9px; border: 2px solid var(--panel-2); padding: 2px 5px; color: var(--ink); white-space: nowrap; }

/* swipe demo (js/ergo.js); hidden until the script wires it up */
.eg-demo { margin-top: 40px; }
.eg-demo__grid { display: grid; gap: 28px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; }
@media (max-width: 760px) { .eg-demo__grid { grid-template-columns: minmax(0, 1fr); } }
.eg-demo h3 { font-family: var(--font-pixel); font-size: 14px; color: var(--c); margin-bottom: 12px; line-height: 1.6; }
.eg-demo__meters { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.eg-demo__meters li { background: var(--edge); border: 2px solid var(--panel-2); text-align: center; padding: 8px 4px; font-size: 18px; color: var(--muted); text-transform: uppercase; }
.eg-demo__meters b { display: block; font-family: var(--font-pixel); font-size: 14px; font-weight: normal; color: var(--cream); }
.eg-demo__log { margin-top: 14px; min-height: 2.8em; color: var(--ink); font-size: 21px; }
.eg-table {
  position: relative; display: grid; place-items: center; padding: 22px 10px 18px; overflow: hidden;
  background: linear-gradient(to bottom, #262b44, #181425); border: 3px solid var(--panel-2);
}
.eg-swipe {
  position: relative; width: min(100%, 272px); background: var(--night); border: 4px solid var(--edge);
  box-shadow: inset 0 0 0 3px var(--gold), var(--shadow); padding: 10px 10px 14px; text-align: center;
  cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none;
  transition: transform .15s steps(3);
}
.eg-swipe.is-dragging { transition: none; cursor: grabbing; }
.eg-swipe:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }
.eg-swipe img { width: 128px; height: 96px; margin: 0 auto; image-rendering: pixelated; border: 2px solid var(--edge); pointer-events: none; }
@media (min-width: 400px) { .eg-swipe img { width: 192px; height: 144px; } }
.eg-swipe__kind { display: inline-block; margin-top: 10px; font-family: var(--font-pixel); font-size: 8px; letter-spacing: 1px; color: var(--edge); background: var(--cream); padding: 4px 6px; }
.eg-swipe__title { font-family: var(--font-pixel); font-size: 11px; color: var(--gold); margin-top: 8px; line-height: 1.6; }
.eg-swipe__text { font-size: 19px; color: var(--ink); margin-top: 6px; line-height: 1.2; }
.eg-swipe__hint { position: absolute; top: 12px; font-family: var(--font-pixel); font-size: 9px; padding: 5px 6px; border: 2px solid currentColor; background: var(--edge); opacity: 0; pointer-events: none; }
.eg-swipe__hint--no { left: 12px; color: var(--refuse); }
.eg-swipe__hint--yes { right: 12px; color: var(--accept); }
.eg-swipe.lean-left .eg-swipe__hint--no, .eg-swipe.lean-right .eg-swipe__hint--yes { opacity: 1; }
.eg-swipe.fly-left { transform: translateX(-140%) rotate(-18deg); }
.eg-swipe.fly-right { transform: translateX(140%) rotate(18deg); }
.eg-demo__buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.eg-btn-no { --b: var(--refuse); }
.eg-btn-yes { --b: var(--accept); }

/* ---------- gallery ---------- */
.eg-gallery { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; }
.eg-gallery .shot { width: 140px; }
.eg-gallery img { width: 128px; height: auto; image-rendering: pixelated; } /* 2x */
.eg-gallery figcaption { font-size: 17px; line-height: 1.15; padding: 6px 2px 2px; }
@media (min-width: 640px) {
  .eg-gallery .shot { width: 204px; }
  .eg-gallery img { width: 192px; } /* 3x */
  .eg-gallery figcaption { font-size: 19px; }
}
.eg-scenes { list-style: none; display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 28px; }
.eg-scenes img { width: 100%; height: auto; aspect-ratio: 180 / 300; }
@media (min-width: 840px) {
  .eg-scenes { display: flex; flex-wrap: wrap; justify-content: center; }
  .eg-scenes .shot { width: 192px; }
  .eg-scenes img { width: 180px; image-rendering: pixelated; } /* 1x of the 180x300 art */
}
/* real phone screenshots (390x844 ratio) shown smaller than real size: smooth sampling */
.eg-shots { list-style: none; display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 28px; }
.eg-shots img { width: 100%; height: auto; aspect-ratio: 390 / 844; }
.eg-shots figcaption { font-size: 17px; line-height: 1.15; padding: 6px 2px 2px; }
@media (min-width: 560px) { .eg-shots { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 840px) { .eg-shots { grid-template-columns: repeat(6, minmax(0, 1fr)); } } /* 12 shots = 2 rows of 6 */
.eg-note { text-align: center; color: var(--muted); font-size: 19px; margin-top: 20px; }

/* ---------- platforms / cartridge ---------- */
.eg-platforms { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: start; }
@media (max-width: 860px) { .eg-platforms { grid-template-columns: minmax(0, 1fr); } }
.eg-platforms .ticklist li { font-size: 22px; }
.eg-cart dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 16px; align-items: baseline; }
.eg-cart dt { font-family: var(--font-pixel); font-size: 9px; color: var(--c); letter-spacing: 1px; }
.eg-cart dd { color: var(--ink); }
.eg-cart__head { font-family: var(--font-pixel); font-size: 12px; color: var(--ink); margin-bottom: 18px; text-align: center; line-height: 1.6; }
.eg-device { display: flex; align-items: center; gap: 16px; margin-top: 22px; }
/* icon is 64px art at 8x: 64 = 1x */
.eg-device img { width: 64px; height: 64px; image-rendering: pixelated; border: 3px solid var(--edge); box-shadow: var(--shadow); flex: none; }
.eg-device p { color: var(--muted); font-size: 20px; }

/* ---------- insert coin (final call) ---------- */
.eg-coin { text-align: center; }
.eg-cartridge {
  position: relative; margin: 0 auto; max-width: 560px; padding: 34px 22px 28px;
  background: #3a4466; border: 4px solid var(--edge); box-shadow: inset 0 -10px 0 #262b44, inset 0 0 0 3px #5a6988, var(--shadow-lg);
  clip-path: polygon(0 18px, 18px 18px, 18px 0, calc(100% - 18px) 0, calc(100% - 18px) 18px, 100% 18px, 100% 100%, 0 100%);
}
.eg-cartridge__label {
  background: var(--bg); border: 4px solid var(--edge); padding: 22px 16px 20px;
  box-shadow: inset 0 0 0 3px var(--blood);
}
.eg-cartridge__label img { width: 128px; height: 128px; margin: 0 auto 14px; image-rendering: pixelated; } /* 2x */
.eg-cartridge__title { font-family: var(--font-pixel); font-size: clamp(18px, 5vw, 26px); color: var(--gold); text-shadow: 3px 3px 0 var(--wine), 5px 5px 0 var(--edge); line-height: 1.4; }
.eg-coin .lead { margin: 22px auto 0; }
.eg-coin .row { justify-content: center; margin-top: 26px; }

/* ---------- cross promo ---------- */
.eg-promo .card__media img { aspect-ratio: 1200 / 630; }
.eg-promo .card__body { display: flex; flex-direction: column; gap: 12px; }
.eg-promo .card__title { font-size: clamp(14px, 2.6vw, 18px); margin: 0; }
.eg-promo .game__tag { font-size: 22px; }
.eg-promo .row { margin-top: auto; padding-top: 6px; }

@media (prefers-reduced-motion: reduce) {
  .js .eg-logo img, .js .eg-phone__card { animation: none; }
  .eg-swipe.fly-left, .eg-swipe.fly-right { transform: none; }
}
