@font-face { font-family: "Trajan Sans Pro"; src: url("fonts/trajansanspro-regular.otf") format("opentype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Trajan Sans Pro"; src: url("fonts/trajansanspro-semibold.otf") format("opentype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Trajan Sans Pro"; src: url("fonts/trajansanspro-bold.otf") format("opentype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Trajan Sans Pro"; src: url("fonts/trajansanspro-black.otf") format("opentype"); font-weight: 900; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("fonts/Nunito.ttf") format("truetype"); font-weight: 200 1000; font-display: swap; }

:root {
  --trajan: "Trajan Sans Pro", serif;
  --nunito: Nunito, sans-serif;
  --gold: rgb(228,192,115);
  --gold-dim: rgb(163,132,67);
  --parchment: rgb(211,197,168);
  --amber: rgb(234,170,25);
  --amber-bright: rgb(248,184,25);
  --blood: rgb(203,57,47);
  --ink: rgb(16,16,16);
  --shadow: 1px 1px 0 rgba(0,0,0,.25);
  /* Set by app.js on resize */
  --stage-scale: 1;
  --map-top: 125px;
  --map-h: 680px;
  --cards-top: 383px;
  --root-h: 900px;
}

html, body { margin: 0; padding: 0; background: var(--ink); }
a { color: var(--amber); text-decoration: none; }
a:hover { color: var(--amber-bright); }
.trajan { font-family: var(--trajan); }

@keyframes fog-a { from { translate: 0 0 } to { translate: -28px -11px } }
@keyframes fog-b { from { translate: 0 0 } to { translate: 34px 9px } }
@keyframes aura { 0%, 100% { opacity: .5 } 50% { opacity: .95 } }
@keyframes flicker { 0%, 100% { opacity: 1 } 41% { opacity: .84 } 46% { opacity: 1 } 68% { opacity: .9 } 72% { opacity: 1 } }
@media (prefers-reduced-motion: reduce) { .fog, .score-num, .cta-glow { animation: none; } }

/* Page: full viewport, scrolls if the 1440 stage is taller than the window */
.page {
  position: relative; width: 100%; height: 100vh;
  overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
  background: var(--ink); font-family: var(--nunito); -webkit-font-smoothing: antialiased;
}
.frame { position: relative; width: 100%; height: var(--root-h); overflow: hidden; }

/* Map: draggable, zoomable, faded top and bottom */
.map-viewport {
  position: absolute; left: 0; right: 0; top: var(--map-top); height: var(--map-h);
  overflow: hidden; touch-action: none; cursor: grab;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 20%, #000 80%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0%, #000 20%, #000 80%, transparent 100%);
}
.map {
  position: absolute; left: 50%; top: 50%;
  background: url(assets/map.webp) center / cover no-repeat; will-change: transform;
  container-type: size; /* lets hex badge text scale in cqw with the map's own render size */
}

/* Hex badges: 6x11 flat-top hex grid overlaid on the map, positioned by app.js from status.json.
   Every box below is sized as a % of its own positioned ancestor, so the whole badge scales
   with `.map` for free; only font-size needs `cqw` (a % of the map itself, not the parent box). */
.hexes { position: absolute; inset: 0; }
.hex-badge { position: absolute; transform: translate(-50%, -50%); font-family: var(--trajan); text-align: center; white-space: nowrap; text-shadow: var(--shadow); }
.hex-conquered { width: 10.518%; height: 7.021%; transform: translate(-41.667%, -50%); cursor: pointer; }
.hex-expand { width: 13.541%; height: 8.179%; cursor: pointer; text-decoration: none; }

.hex-shadow {
  position: absolute; left: -24.638%; top: -24.963%; width: 133.333%; height: 87.371%; border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(1,0,0,.51) 0%, rgba(93,25,25,0) 70%);
}
.hex-name-plate {
  position: absolute; left: 10.145%; top: 4.161%; width: 82.609%; height: 48.539%;
  background: url(assets/ShortLineBack.webp) center / cover no-repeat;
  display: flex; align-items: center; justify-content: center;
}
.hex-name { font-weight: 600; font-size: .7622cqw; color: var(--gold); }

.hex-attack-plate {
  position: absolute; left: 0; top: 0; width: 100%; height: 58.044%;
  background: url(assets/button.webp) center / 100% 100% no-repeat;
  display: flex; align-items: center; justify-content: center;
}
.hex-attack-text { font-weight: 700; font-size: 1.5244cqw; color: var(--amber-bright); opacity: .9; text-shadow: 1px -.5px 0 rgb(0,0,0); }

.hex-score-plate {
  position: absolute; left: -3.623%; top: 37.445%; width: 97.826%; height: 58.247%;
  background: url(assets/hex-plate.webp) center / cover no-repeat;
}
.hex-expand .hex-score-plate { left: 9.569%; top: 50%; width: 75.988%; height: 50%; }
.hex-label { position: absolute; font-weight: 400; font-size: .7622cqw; color: var(--gold); }
.hex-label-rome { left: 19.481%; top: 23.81%; width: 23.704%; }
.hex-label-dacia { left: 62.444%; top: 21.429%; width: 23.704%; }
.hex-num { position: absolute; font-weight: 600; font-size: 1.2195cqw; color: var(--gold); }
.hex-num-rome { left: 23.185%; top: 52.381%; width: 15.556%; color: var(--blood); }
.hex-num-dacia { left: 66.889%; top: 52.381%; width: 14.815%; }
.hex-fight { position: absolute; left: 46.148%; top: 28.571%; width: 13.333%; height: 42.857%; }

.hex-seal { position: absolute; left: -10.87%; top: -4.161%; width: 29.362%; height: 54.087%; }
.hex-seal-fill {
  position: absolute; left: 15.903%; top: 14.179%; width: 68.189%; height: 70.923%; border-radius: 50%;
  background: linear-gradient(180deg, rgb(66,62,47) 0%, rgb(17,15,10) 100%);
}
.hex-seal-ring { position: absolute; inset: 0; background: url(assets/ring.webp) center / 100% 100% no-repeat; }
.hex-seal-num { position: absolute; left: 4.936%; top: 30%; width: 88.846%; font-weight: 600; font-size: .9146cqw; color: var(--gold); }

/* Stage: 1440px design frame, centered, scaled down on narrow screens.
   Click-through so the map underneath can be dragged; only controls catch the pointer. */
.stage {
  position: absolute; left: 50%; top: 0; width: 1440px; height: 100%;
  transform: translateX(-50%) scale(var(--stage-scale)); transform-origin: top center;
  pointer-events: none;
}
.about-btn, .cta, .footer a { pointer-events: auto; }

/* Hero: one 580px block centered on the stage; fog, guy, panel, "?" and day badge all share its center.
   Fog drifts via `translate` so it does not fight the rotate in `transform`. */
.hero { position: absolute; left: 50%; top: -183px; width: 580px; height: 457px; margin-left: -290px; }
.hero-shadow { position: absolute; left: 59px; top: 247px; width: 470px; height: 172px; background: url(assets/circle-shadow.svg) no-repeat; }
.guy {
  position: absolute; left: 387px; top: 152px; width: 187px; height: 278px;
  background: url(assets/guy.webp) 0% 50% / 156% 100% no-repeat; transform: rotate(-1.1deg) scaleX(-1);
}
.fog { position: absolute; background: url(assets/fog.webp) center / cover no-repeat; }
.fog-hero { width: 254px; height: 342px; margin: -171px 0 0 -127px; }
.fog-hero-a { left: 450px; top: 173px; transform: rotate(-179deg); animation: fog-a 46s ease-in-out infinite alternate; }
.fog-hero-b { left: 211px; top: 247px; transform: rotate(135deg) scaleX(-1); animation: fog-b 61s ease-in-out infinite alternate; }

.hero-panel {
  position: absolute; left: 50%; top: 203px; width: 396px; height: 217px; margin-left: -198px;
  background-image: url(assets/panel2.webp); background-repeat: no-repeat; background-size: 100% 132px; background-position: center 43px;
  text-align: center; line-height: 1; white-space: nowrap; font-family: var(--trajan);
}
.hero-panel > * { position: absolute; left: 0; right: 0; }
.eyebrow { top: 0; font-weight: 600; font-size: 22px; color: var(--gold); text-shadow: var(--shadow); }
.sub-eyebrow { top: 25px; font-weight: 400; font-size: 12px; color: var(--gold-dim); }
.title { top: 95px; margin: 0; font-weight: 900; font-size: 32px; text-transform: uppercase; color: var(--gold); text-shadow: var(--shadow); }
.tagline-band {
  top: 159px; height: 21px; left: 2px; right: 1px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(90deg, rgba(23,22,29,0) 0%, rgba(23,22,29,.8) 20%, rgb(23,22,29) 50%, rgba(23,22,29,.8) 80%, rgba(23,22,29,0) 100%);
}
.tagline { font-family: var(--nunito); font-size: 14px; color: var(--parchment); }

/* "?" button, overlapping the panel's left edge */
.about-btn {
  left: -4px; right: auto; top: 34px; width: 55px; height: 53px;
  padding: 0; border: 0; background: none; cursor: pointer; overflow: hidden;
}
.about-btn:hover { filter: brightness(1.22); }
.about-btn-fill { position: absolute; left: 9px; top: 8px; width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(180deg, rgb(66,62,47) 0%, rgb(17,15,10) 100%); }
.ring { position: absolute; inset: 0; background: url(assets/ring.webp) 0% 0% / 100% 108% no-repeat; }
.about-btn-mark { position: absolute; left: 20px; top: 16px; font-family: var(--trajan); font-weight: 600; font-size: 24px; line-height: 1; color: var(--gold); }

/* Day badge, centered under the panel; text centers on the bar, not the seal */
.day-badge { position: absolute; left: 50%; top: 383px; width: 133px; height: 39px; margin-left: -66.5px; overflow: hidden; }
.day-badge-back { position: absolute; left: 17px; top: 0; width: 116px; height: 39px; background: url(assets/ShortLineBack.webp) center / 100% 100% no-repeat; }
.day-badge-seal { position: absolute; left: 0; top: 0; width: 39px; height: 38px; transform: matrix(0,-1,1,0,0,39); transform-origin: 0 0; overflow: hidden; }
.bullet { position: absolute; left: 8px; top: 6px; width: 27px; height: 24px; background: url(assets/bullet.webp) center / cover no-repeat; }
.day-badge-text {
  position: absolute; left: 17px; right: 0; top: 13px; text-align: center; white-space: nowrap; text-transform: uppercase;
  font-family: var(--trajan); font-weight: 900; font-size: 12px; line-height: 1; color: var(--gold); text-shadow: var(--shadow);
}
.day-badge-text [data-field="day"] { color: var(--blood); }

/* Cards block: panel, score fog, cards, scores, drag hint, CTA, footer.
   top is a CSS var so app.js can push it down to the frame's bottom on tall viewports. */
.cards { position: absolute; left: 50%; top: var(--cards-top); width: 470px; height: 515px; margin-left: -235px; }
.vignette {
  position: absolute; left: 0; top: 46px; width: 470px; height: 469px; overflow: hidden;
  -webkit-mask-image: radial-gradient(239px 239px at 50% 50%, #000 0%, #000 58%, rgba(0,0,0,.62) 82%, transparent 100%);
  mask-image: radial-gradient(239px 239px at 50% 50%, #000 0%, #000 58%, rgba(0,0,0,.62) 82%, transparent 100%);
}
.vignette-fill { position: absolute; left: -18px; top: -41px; width: 504px; height: 581px; background: linear-gradient(180deg, rgba(0,0,0,0) 7%, rgb(24,19,19) 26%, rgb(51,43,43) 60%, rgb(0,0,0) 93%); }
.ground {
  position: absolute; left: 35px; top: -5px; width: 390px; height: 273px;
  background: url(assets/ground.webp) left bottom / cover no-repeat;
}

.status-panel {
  position: absolute; left: 50%; top: 222px; width: 272px; height: 91px; margin-left: -136px;
  background: url(assets/panel2.webp) center / 100% 100% no-repeat;
}
.fog-score {
  position: absolute; top: 123px; width: 243px; height: 181px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.fog-score::before { content: ""; width: 181px; height: 243px; background: url(assets/fog.webp) center / cover no-repeat; }
.fog-score-rome { left: 15px; }
.fog-score-rome::before { transform: rotate(90deg) scaleX(-1); }
.fog-score-dacia { left: 223px; }
.fog-score-dacia::before { transform: rotate(-90deg); }

.scores { position: absolute; left: 0; right: 0; top: 250px; z-index: 1; display: flex; justify-content: center; align-items: center; gap: 57px; }
.score { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 70px; font-family: var(--trajan); text-shadow: var(--shadow); }
.score-name { font-weight: 400; font-size: 16px; line-height: 1; white-space: nowrap; }
.score-num { font-weight: 600; font-size: 20px; line-height: 1; animation: flicker 9.1s ease-in-out infinite; }
.score-rome { color: var(--blood); }
.score-dacia { color: var(--gold); }
.score-rome .score-num { animation-duration: 7.3s; }
.score-rule { width: 1px; height: 22px; background: var(--gold); }

.drag-hint {
  position: absolute; left: 50%; top: 0; z-index: 1; width: 212px; height: 34px; margin-left: -106px;
  box-sizing: border-box; display: flex; align-items: center; padding-left: 16px; gap: 10px;
  white-space: nowrap; text-transform: uppercase;
  font-size: 10px; line-height: 1; color: var(--parchment); text-shadow: .2px .2px 0 rgba(0,0,0,.25);
  opacity: 1; transition: opacity .4s ease;
}
.drag-hint.is-hidden { opacity: 0; pointer-events: none; }
.drag-hint::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, transparent, #171718 48%, transparent);
}
.drag-hand { position: relative; width: 33px; height: 42px; flex: none; margin-left: auto; background: url(assets/drag-hand.webp) center / 100% 100% no-repeat; }

.cta {
  position: absolute; left: 50%; top: 298px; width: 366px; height: 100px; margin-left: -183px;
  display: flex; align-items: center; justify-content: center;
}
.cta:hover { filter: brightness(1.1) saturate(1.06); }
.cta:active { transform: translateY(1px); }
.cta-glow {
  position: absolute; inset: -10px;
  background: radial-gradient(ellipse at center, var(--amber-bright) 0%, var(--amber) 55%, transparent 70%);
  -webkit-mask-image: url(assets/button.webp); mask-image: url(assets/button.webp);
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  filter: url(#cta-noise) blur(10px);
  mix-blend-mode: screen;
  animation: aura 6s ease-in-out infinite;
  pointer-events: none;
}
.cta-bg { position: absolute; inset: 0; background: url(assets/button.webp) center / 100% 100% no-repeat; }
.cta-text {
  position: relative; width: 220px; opacity: .9; text-align: center;
  font-family: var(--trajan); font-weight: 700; font-size: 24px; line-height: 1.2; color: var(--amber-bright); text-shadow: 1px -.5px 0 rgb(0,0,0);
}

.footer { position: absolute; left: 0; right: 0; top: 411px; display: flex; flex-direction: column; align-items: center; gap: 12px; font-size: 12px; line-height: 1; color: var(--parchment); }
.footer-discord { font-weight: 600; font-size: 14px; white-space: nowrap; }
.footer-follow { display: flex; align-items: center; gap: 5px; height: 22px; }
.gamefound { display: block; width: 93px; height: 22px; background: url(assets/gamefound.webp) center / cover no-repeat; }
.gamefound:hover { filter: brightness(1.15); }

/* About modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 40; padding: 24px;
  display: flex; align-items: center; justify-content: center; overflow-y: auto;
  background: rgba(0,0,0,.55); backdrop-filter: blur(2px);
}
/* `safe` keeps a too-tall modal scrollable to its top edge instead of clipping it above center */
.modal-backdrop { align-items: safe center; }
.modal-backdrop[hidden] { display: none; }
.modal {
  position: relative; width: min(420px, 100%);
  padding: 34px 32px 30px;
  background: linear-gradient(180deg, rgb(32,30,30) 0%, rgb(17,15,10) 100%);
  border: 1px solid rgb(184,167,131); box-shadow: 0 24px 70px rgba(0,0,0,.7);
}
.modal-close { position: absolute; right: 12px; top: 8px; width: 26px; height: 26px; padding: 0; border: 0; background: none; color: rgb(184,167,131); font-size: 18px; line-height: 1; cursor: pointer; }
.modal-close:hover { color: var(--gold); }
.modal-eyebrow { font-family: var(--trajan); font-weight: 600; font-size: 14px; line-height: 1; letter-spacing: .4px; color: var(--gold-dim); }
.modal-title { margin-top: 12px; font-family: var(--trajan); font-weight: 900; font-size: 20px; line-height: 1.2; color: var(--gold); }
.modal-body { margin-top: 16px; display: flex; flex-direction: column; gap: 11px; font-size: 12px; line-height: 1.6; color: var(--parchment); }
.modal-body p { margin: 0; }
.modal-body strong { color: var(--gold-dim); font-weight: 700; }
.modal-links { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 16px; font-weight: 600; font-size: 12px; line-height: 1; }

/* Info modal (Popup_Info): richer intro card with eagle banner, divider and box/figure art */
.info-modal { width: min(396px, 100%); padding: 0 0 26px; position: relative; }
.info-banner {
  width: calc(100% + 32px); height: 143px; margin: -14px -16px 0;
  background: url(assets/panel2.webp) center top / 100% auto no-repeat;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 65%);
  mask-image: linear-gradient(to bottom, #000 0%, transparent 65%);
}
.info-close {
  position: absolute; right: 8px; top: -20px; width: 55px; height: 53px;
  padding: 0; border: 0; background: none; cursor: pointer; overflow: hidden;
}
.info-close:hover { filter: brightness(1.22); }
.info-close-fill { position: absolute; left: 9px; top: 8px; width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(180deg, rgb(66,62,47) 0%, rgb(17,15,10) 100%); }
.info-close-mark { position: absolute; left: 20px; top: 15px; font-family: var(--trajan); font-weight: 600; font-size: 22px; line-height: 1; color: var(--gold); }
.info-head { margin: -92px 30px 0; position: relative; }
.info-head .modal-eyebrow { font-size: 22px; color: var(--gold); text-shadow: var(--shadow); }
.info-sub-eyebrow { margin-top: 3px; font-family: var(--trajan); font-weight: 400; font-size: 12px; color: var(--gold-dim); }
.info-title { margin: 14px 30px 0; font-size: 26px; text-transform: uppercase; }
.info-modal .modal-body { margin-left: 30px; margin-right: 30px; font-family: var(--nunito); font-size: 13px; }
.info-body-sm { max-width: 210px; font-size: 12px; }
.info-divider { position: relative; height: 1px; margin: 18px 30px 16px; background: linear-gradient(to right, transparent, rgb(151,127,83) 50%, transparent); }
.info-divider-mark {
  position: absolute; left: 50%; top: 50%; width: 70px; height: 24px; transform: translate(-50%, -50%);
  background: url(assets/info-eagle.webp) center / contain no-repeat;
}
.info-follow {
  display: flex; align-items: center; gap: 10px; margin: 18px 30px 0;
  font-family: var(--nunito); font-weight: 700; font-size: 14px; color: var(--parchment);
}
.info-statue {
  position: absolute; z-index: 1; right: 15%; bottom: -2%; width: 26%; aspect-ratio: 96 / 134; pointer-events: none;
  background: url(assets/info-statue.webp) center bottom / cover no-repeat;
}
.info-box {
  position: absolute; right: -14%; bottom: -3%; width: 66%; aspect-ratio: 261 / 272; pointer-events: none;
  background: url(assets/info-box.webp) center / cover no-repeat;
}

/* Hex info modal */
.hex-info-modal { width: min(396px, 100%); padding: 0 0 30px; }
.hex-info-modal .info-banner { margin-bottom: 0; }
.hex-info-head {
  position: relative; margin: -92px 30px 0; font-family: var(--trajan); font-weight: 600;
  font-size: 22px; line-height: 1; letter-spacing: .4px; color: var(--gold); text-shadow: var(--shadow);
}
.hex-info-title { margin: 14px 30px 0; font-size: 26px; text-transform: uppercase; }
.hex-info-modal .modal-body { margin: 16px 30px 0; font-family: var(--nunito); font-size: 13px; }
.hex-info-scores { display: flex; gap: 24px; }
.hex-info-score { flex: 1; text-align: center; }
.hex-info-score-name { font-family: var(--trajan); font-size: 11px; letter-spacing: .4px; color: var(--gold-dim); }
.hex-info-score-num { margin-top: 4px; font-weight: 700; font-size: 22px; color: var(--gold); }
.hex-info-score-rome .hex-info-score-num { color: var(--blood); }

/* Puzzle holding screen */
.puzzle-page { min-height: 100vh; background: var(--ink); }
.puzzle-screen {
  min-height: 100vh; box-sizing: border-box; display: flex; align-items: center; justify-content: center;
  padding: 24px; overflow: hidden;
}
.puzzle-modal { margin: auto; }
.puzzle-return {
  display: inline-flex; align-items: center; justify-content: center; width: 220px; aspect-ratio: 732 / 201;
  margin: 22px 30px 0; box-sizing: border-box; text-align: center; line-height: 1.15;
  background: url(assets/button.webp) center / 100% 100% no-repeat;
  font-family: var(--trajan); font-weight: 700; font-size: 13px; color: var(--amber-bright); text-shadow: var(--shadow);
}
.puzzle-return:hover { color: var(--amber-bright); filter: brightness(1.15); }

@media (max-width: 520px) {
  .puzzle-screen { align-items: flex-start; padding: 40px 16px; }
  .puzzle-modal { width: 100%; }
  .puzzle-modal .info-title { font-size: 22px; }
  .puzzle-modal .info-statue, .puzzle-modal .info-box { display: none; }
}
