/* Heroes of History — quiz prelander
   Brand-neutral fast stack (no render-blocking web fonts). CJK system fonts
   keep JP/KR crisp. Swap in the official heroesgame.com display font later. */

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  border: none;
  text-decoration: none;
}

body {
  font-family: "Trebuchet MS", "Segoe UI", system-ui, -apple-system,
               "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo,
               "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  height: 100vh;
  overflow: hidden;
}

/* ── Background ── */
#main-frame {
  position: relative;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#main-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  /* Default gradient shows until/unless a ?bg= CDN image loads (set by quiz.js) */
  background-image: var(--bg-url,
    radial-gradient(120% 120% at 50% 10%, #2c3a4f 0%, #1a2230 55%, #0e1219 100%));
  background-size: cover;
  background-position: center bottom;
  background-repeat: no-repeat;
  z-index: 0;
}

/* ── Header ── */
.hw-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.2rem;
  position: relative;
  z-index: 2;
}

.hw-players {
  font-size: 0.72rem;
  font-weight: 400;
  color: #ffd76a;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.hw-players span {
  font-weight: 700;
  color: #ffd76a;
}

/* ── Quiz card ── */
.card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 620px;
  min-width: 620px;
  height: 380px;
  background: rgba(16, 18, 24, 0.84);
  border: 1px solid rgba(232, 176, 75, 0.35);
  border-radius: 10px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  padding: 48px;
  text-align: center;
  font-size: 40px;
  line-height: 48px;
  text-transform: uppercase;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

/* ── Pages ── */
.page { display: none; width: 100%; }
.page.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}

/* ── Question ── */
.card h2 {
  font-size: 38px;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  line-height: 46px;
  letter-spacing: 0.01em;
  margin-bottom: 0;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.hl-gold  { color: #E8B04B; }
.hl-green { color: #5FC26B; }
.hl-red   { color: #E83030; }

/* ── Buttons ── */
.btn-row {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn-row button {
  background: linear-gradient(180deg, #f0bd5c 0%, #E8B04B 50%, #cf962f 100%);
  border: none;
  border-radius: 6px;
  outline: none;
  -webkit-appearance: none;
  box-shadow: 0 3px 0 #a9781f, 0 6px 14px rgba(0, 0, 0, 0.35);
  color: #2a1c05;
  font-family: inherit;
  font-size: 26px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.8rem 2.5rem;
  min-width: 190px;
  cursor: pointer;
  transition: filter 0.2s, transform 0.15s, box-shadow 0.15s;
}

.btn-row button:focus,
.btn-row button:active {
  outline: none;
}

.btn-row button:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.btn-row button:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #a9781f, 0 3px 8px rgba(0, 0, 0, 0.35);
}

/* Wide single button (CTA / last step) */
#page-8 .btn-row button {
  min-width: 280px;
}

.btn-row a {
  text-decoration: none;
}

/* ── Footer ── */
footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #000;
  padding: 0.5rem 1rem;
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  z-index: 10;
}

footer a {
  font-family: inherit;
  font-size: 0.55rem;
  color: #aaa;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

footer a:hover { color: #fff; }

/* ── Loader bar ── */
.loader-line {
  position: relative;
  width: 100%;
  max-width: 360px;
  height: 10px;
  margin: 1.2rem auto 0.4rem;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 5px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
}

.loader-line::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #cf962f, #ffdf7a, #E8B04B);
  border-radius: 5px;
  animation: loader-fill 2.5s linear forwards;
}

@keyframes loader-fill {
  from { width: 0; }
  to   { width: 100%; }
}

/* ── Card position (?position=left|right) ── only ≥1024px ── */
@media (min-width: 1024px) {
  body.pos-left .card,
  body.pos-right .card {
    min-width: 0;
    width: 620px;
  }
  body.pos-left .card {
    left: 5%;
    right: auto;
    transform: translate(0, -50%);
  }
  body.pos-right .card {
    left: auto;
    right: 5%;
    transform: translate(0, -50%);
  }
}

/* ── Responsive ── */
@media (max-width: 660px) {
  .card {
    min-width: 0;
    width: 92%;
    height: auto;
    min-height: 320px;
    padding: 1.6rem 1.2rem 1.9rem;
    font-size: 1.1rem;
    line-height: 1.4rem;
  }
  .card h2 {
    font-size: 1.15rem;
    line-height: 1.5rem;
  }
  .btn-row {
    flex-direction: column;
    align-items: center;
    width: 100%;
  }
  .btn-row button {
    width: 100%;
    max-width: 320px;
    font-size: 1.1rem;
  }
  body.pos-left .card,
  body.pos-right .card {
    left: 50%;
    right: auto;
    transform: translate(-50%, -50%);
  }
}
