@import url("./experience.css");
@import url("./leaderboard.css");
@import url("./journey-polish.css");
/* =========================================================================
   THE LAST MAN — shared stylesheet
   One file for every page. Gold-on-dark identity carried over from the
   prototype, rebuilt mobile-first: safe-area aware, no page scroll, no zoom,
   and every text size clamped so it stays readable on a small phone.
   ========================================================================= */

:root {
  --gold: #f5c542;
  --gold-dark: #c99a1f;
  --ink: #1a1530;
  --danger: #ff6b6b;
  --good: #4ade80;
  --panel: rgba(26, 21, 48, 0.82);
  --panel-solid: #241d42;
  --line: rgba(255, 255, 255, 0.14);
  --text-dim: rgba(255, 255, 255, 0.78);

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
  /* Locking the document is what stops rubber-band scroll and pull-to-refresh
     from fighting a swipe control. */
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--ink);
  font-family: 'Sora', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: #fff;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  position: fixed;
  inset: 0;
  touch-action: none;
}

#wrap {
  position: fixed;
  inset: 0;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.hidden {
  display: none !important;
}

/* ---------------------------------------------------------------- HUD --- */

#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  padding: var(--safe-t) var(--safe-r) var(--safe-b) var(--safe-l);
}

/* Countries range from a pale Lagos sunrise to Tokyo at night, and white HUD
   text has to stay readable over both. A soft scrim costs nothing and fixes it
   everywhere at once. */
#hud::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 200px;
  background: linear-gradient(to bottom, rgba(18, 13, 34, 0.5), rgba(18, 13, 34, 0));
  pointer-events: none;
}

body.overlay-open #hud,
body.overlay-open #pad,
body.overlay-open #banner,
body.overlay-open #loadNote {
  opacity: 0;
  visibility: hidden;
}

.hud-topleft {
  position: absolute;
  top: max(14px, var(--safe-t));
  left: max(14px, var(--safe-l));
}

.mag {
  font-size: clamp(28px, 7vw, 46px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.22);
}
.mag.low {
  color: var(--danger);
}
.mag small {
  font-size: 0.32em;
  font-weight: 700;
  opacity: 0.8;
  margin-left: 5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.goal {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.goalbar {
  width: min(150px, 38vw);
  height: 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.22);
  overflow: hidden;
}
.goalbar i {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--gold);
  transition: width 0.3s;
}
.goal span {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.city {
  margin-top: 6px;
  font-size: clamp(11px, 3vw, 14px);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
}

.hud-topright {
  position: absolute;
  top: max(14px, var(--safe-t));
  right: max(12px, var(--safe-r));
  display: flex;
  gap: 6px;
  align-items: flex-start;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 62vw;
}

.chip {
  pointer-events: auto;
  background: var(--panel);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  color: #fff;
  border-radius: 12px;
  padding: 9px 11px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
  user-select: none;
  min-height: 38px;
}
.chip.stat {
  cursor: default;
}
.chip .lbl {
  font-size: 0.7em;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.9;
}
.chip:active {
  transform: translateY(1px);
}
.chip.active {
  background: rgba(245, 197, 66, 0.28);
  border-color: var(--gold);
}
.chip.icon {
  font-size: 16px;
  padding: 9px 12px;
}

/* Stacking order down the top of the screen: HUD block (~14–96px),
   then the transient banner, then the combo. None of them may overlap the
   chip row on the right, which is why both are pushed below it. */
.combo {
  position: absolute;
  top: max(168px, calc(var(--safe-t) + 162px));
  left: 50%;
  transform: translateX(-50%) scale(0.6);
  text-align: center;
  opacity: 0;
  transition: opacity 0.12s;
}
.combo.on {
  opacity: 1;
}
.combo .x {
  font-size: clamp(30px, 8.5vw, 56px);
  font-weight: 800;
  color: var(--gold);
  line-height: 0.9;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.25);
}
.combo .lbl {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  opacity: 0.85;
  margin-top: 2px;
}
.combo .bar {
  margin: 8px auto 0;
  width: 110px;
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.2);
  overflow: hidden;
}
.combo .bar i {
  display: block;
  height: 100%;
  background: var(--gold);
  width: 100%;
  transform-origin: left;
}

.statusline {
  position: absolute;
  bottom: max(14px, var(--safe-b));
  left: max(16px, var(--safe-l));
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
.statusline b {
  color: var(--gold);
}

#floaters {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.floater {
  position: absolute;
  font-weight: 800;
  font-size: clamp(15px, 4vw, 20px);
  color: var(--gold);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  transform: translate(-50%, -50%);
  white-space: nowrap;
  will-change: transform, opacity;
}
.floater.bad {
  color: var(--danger);
}

#banner {
  position: absolute;
  top: calc(var(--safe-t) + 112px);
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  background: rgba(26, 21, 48, 0.66);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(245, 197, 66, 0.4);
  border-radius: 999px;
  padding: 9px 18px;
  font-weight: 800;
  font-size: clamp(12px, 3.3vw, 16px);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  max-width: 88vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#banner.show {
  opacity: 1;
}

#flash,
#hurt {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}
#flash {
  background: radial-gradient(circle at 50% 45%, #fff, #ffe6a8);
  transition: opacity 1.1s ease-out;
  z-index: 4;
}
#hurt {
  background: radial-gradient(circle at 50% 55%, rgba(255, 60, 60, 0), rgba(200, 20, 20, 0.55));
  transition: opacity 0.45s ease-out;
  z-index: 3;
}

/* ------------------------------------------------------ on-screen pad --- */

#pad {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: none;
}
#pad.on {
  display: block;
}
.padbtn {
  position: absolute;
  pointer-events: auto;
  background: rgba(26, 21, 48, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  user-select: none;
  backdrop-filter: blur(4px);
  font-size: 24px;
  touch-action: none;
}
.padbtn:active {
  background: rgba(245, 197, 66, 0.55);
  color: var(--ink);
}
#pad-left {
  left: calc(16px + var(--safe-l));
  bottom: calc(104px + var(--safe-b));
  width: 66px;
  height: 66px;
}
#pad-right {
  left: calc(90px + var(--safe-l));
  bottom: calc(104px + var(--safe-b));
  width: 66px;
  height: 66px;
}
#pad-jump {
  right: calc(16px + var(--safe-r));
  bottom: calc(128px + var(--safe-b));
  width: 72px;
  height: 72px;
}
#pad-slide {
  right: calc(96px + var(--safe-r));
  bottom: calc(84px + var(--safe-b));
  width: 72px;
  height: 72px;
}
#pad-throw {
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(24px + var(--safe-b));
  width: min(158px, 44vw);
  height: 56px;
  font-size: 15px;
  letter-spacing: 0.1em;
  background: var(--gold);
  color: var(--ink);
  border-color: var(--gold);
}

/* ---------------------------------------------------------- overlays --- */

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: calc(24px + var(--safe-t)) calc(20px + var(--safe-r)) calc(24px + var(--safe-b))
    calc(20px + var(--safe-l));
  background: radial-gradient(120% 90% at 50% 18%, rgba(26, 21, 48, 0.55), rgba(26, 21, 48, 0.94));
  backdrop-filter: blur(3px);
  pointer-events: auto;
  z-index: 5;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.overlay.gold {
  background: radial-gradient(120% 90% at 50% 30%, rgba(245, 197, 66, 0.34), rgba(26, 21, 48, 0.94));
}
.overlay.danger {
  background: radial-gradient(120% 90% at 50% 30%, rgba(255, 107, 107, 0.28), rgba(26, 21, 48, 0.95));
}
.overlay.scroll-top {
  justify-content: flex-start;
}
/* Brief input lock so a tap that ended the previous screen cannot also press
   the button that just appeared under the finger. */
.overlay.guard .cta,
.overlay.guard .answer {
  pointer-events: none;
  opacity: 0.55;
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
  margin-bottom: 12px;
}
.title {
  font-size: clamp(32px, 10vw, 74px);
  font-weight: 800;
  line-height: 0.94;
  letter-spacing: -0.03em;
  text-shadow: 0 6px 0 rgba(0, 0, 0, 0.24);
}
.title.small {
  font-size: clamp(26px, 7.5vw, 52px);
}
.title .man {
  color: var(--gold);
}
.sub {
  margin-top: 12px;
  font-size: clamp(13px, 3.4vw, 16px);
  font-weight: 600;
  color: var(--text-dim);
  max-width: 42ch;
  line-height: 1.5;
}
.flagline {
  font-size: clamp(40px, 13vw, 76px);
  line-height: 1;
  margin-bottom: 6px;
}

.cta {
  margin-top: 18px;
  background: var(--gold);
  color: var(--ink);
  border: none;
  border-radius: 16px;
  font-family: inherit;
  font-weight: 800;
  font-size: clamp(15px, 4.2vw, 19px);
  padding: 15px 28px;
  cursor: pointer;
  box-shadow: 0 8px 0 var(--gold-dark), 0 14px 26px rgba(0, 0, 0, 0.35);
  min-height: 52px;
  max-width: 100%;
}
.cta:active {
  transform: translateY(4px);
  box-shadow: 0 4px 0 var(--gold-dark), 0 8px 16px rgba(0, 0, 0, 0.3);
}
.cta:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  box-shadow: 0 8px 0 #7a5f13;
}
.cta.ghost {
  background: transparent;
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  box-shadow: none;
  margin-top: 10px;
}
.cta.ghost:active {
  transform: translateY(2px);
  box-shadow: none;
}
.cta.violet {
  background: #7c5cff;
  color: #fff;
  box-shadow: 0 8px 0 #4b34c2, 0 14px 26px rgba(0, 0, 0, 0.35);
}
.cta.violet:active {
  box-shadow: 0 4px 0 #4b34c2;
}

.rules {
  margin-top: 18px;
  display: grid;
  gap: 8px;
  max-width: 430px;
  width: 100%;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  text-align: left;
}
.rules div {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.rules b {
  color: var(--gold);
  flex: 0 0 auto;
  min-width: 2.4em;
}

.statline {
  margin-top: 14px;
  display: flex;
  gap: 22px;
  justify-content: center;
  font-weight: 700;
  flex-wrap: wrap;
}
.statline div {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.statline b {
  display: block;
  font-size: 24px;
  color: #fff;
  margin-top: 2px;
  letter-spacing: 0;
  text-transform: none;
}

.field {
  width: 100%;
  max-width: 320px;
  margin-top: 10px;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-family: inherit;
  /* 16px minimum stops iOS Safari zooming the page when the field focuses. */
  font-size: 16px;
}
.field::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

/* ------------------------------------------------------------ trivia --- */

.answers {
  margin-top: 16px;
  display: grid;
  gap: 10px;
  width: 100%;
  max-width: 460px;
}
.answer {
  font-family: inherit;
  font-weight: 700;
  font-size: clamp(14px, 3.8vw, 17px);
  text-align: left;
  padding: 15px 16px;
  border-radius: 14px;
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  cursor: pointer;
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 12px;
  line-height: 1.35;
}
.answer .key {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: rgba(245, 197, 66, 0.22);
  color: var(--gold);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
}
.answer:active {
  transform: translateY(2px);
}
.answer.correct {
  border-color: var(--good);
  background: rgba(74, 222, 128, 0.2);
}
.answer.correct .key {
  background: rgba(74, 222, 128, 0.3);
  color: var(--good);
}
.answer.wrong {
  border-color: var(--danger);
  background: rgba(255, 107, 107, 0.2);
}
.answer.wrong .key {
  background: rgba(255, 107, 107, 0.3);
  color: var(--danger);
}
.answer:disabled {
  cursor: default;
}

.verdict {
  margin-top: 14px;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: clamp(16px, 5vw, 24px);
}
.verdict.granted {
  color: var(--good);
}
.verdict.denied {
  color: var(--danger);
}

/* ------------------------------------------------------ misc panels --- */

.lb {
  margin-top: 14px;
  width: 100%;
  max-width: 380px;
  text-align: left;
}
.lb .row {
  display: flex;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
}
.lb .row:nth-child(odd) {
  background: rgba(255, 255, 255, 0.06);
}
.lb .row .rk {
  color: var(--gold);
  width: 30px;
  display: inline-block;
}

.checklist {
  margin-top: 14px;
  width: 100%;
  max-width: 420px;
  display: grid;
  gap: 7px;
  text-align: left;
}
.checklist .item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 13px;
  font-weight: 700;
}
.checklist .item.ok {
  background: rgba(74, 222, 128, 0.14);
}
.checklist .item .v {
  color: var(--gold);
  white-space: nowrap;
}
.checklist .item.ok .v {
  color: var(--good);
}

.notice {
  margin-top: 14px;
  max-width: 42ch;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px dashed rgba(245, 197, 66, 0.5);
  color: rgba(255, 255, 255, 0.85);
  background: rgba(245, 197, 66, 0.08);
}
.notice.warn {
  border-color: rgba(255, 107, 107, 0.55);
  background: rgba(255, 107, 107, 0.1);
}

.packgrid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
  gap: 8px;
  width: 100%;
  max-width: 380px;
}
.pack {
  font-family: inherit;
  border-radius: 14px;
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  padding: 12px 8px;
  cursor: pointer;
  font-weight: 800;
  min-height: 66px;
}
.pack.sel {
  border-color: var(--gold);
  background: rgba(245, 197, 66, 0.22);
}
.pack small {
  display: block;
  font-size: 11px;
  font-weight: 700;
  opacity: 0.72;
  margin-top: 3px;
}

#loadNote {
  position: absolute;
  bottom: max(14px, var(--safe-b));
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
  max-width: 82vw;
  text-align: center;
}
#loadNote.show {
  opacity: 1;
}

.newbest {
  margin-top: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  font-size: 13px;
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse {
  50% {
    opacity: 0.45;
  }
}
@media (prefers-reduced-motion: reduce) {
  .newbest {
    animation: none;
  }
  .cta:active,
  .answer:active {
    transform: none;
  }
}

/* Short landscape phones: tighten everything so the CTA stays reachable. */
@media (max-height: 460px) {
  .title {
    font-size: clamp(24px, 7vw, 40px);
  }
  .flagline {
    font-size: clamp(28px, 8vw, 44px);
  }
  .rules,
  .statline {
    margin-top: 10px;
  }
  .cta {
    margin-top: 12px;
    padding: 12px 22px;
    min-height: 46px;
  }
  .overlay {
    justify-content: flex-start;
  }
}

/* ------------------------------------------------------- journey hub --- */

.hub {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  padding: calc(28px + var(--safe-t)) 18px calc(40px + var(--safe-b));
  background: radial-gradient(120% 70% at 50% 0%, #2c2350, #140f26);
}
.hub-inner {
  max-width: 620px;
  margin: 0 auto;
  text-align: center;
}
.journey {
  margin-top: 22px;
  display: grid;
  gap: 10px;
  text-align: left;
}
.stop {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 16px;
  border: 1.5px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: inherit;
  text-decoration: none;
  font-family: inherit;
}
.stop .flag {
  font-size: 28px;
  line-height: 1;
}
.stop .who {
  flex: 1 1 auto;
  min-width: 0;
}
.stop .who b {
  display: block;
  font-size: 16px;
  font-weight: 800;
}
.stop .who span {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 600;
}
.stop .state {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.stop.done {
  border-color: rgba(74, 222, 128, 0.5);
}
.stop.done .state {
  background: rgba(74, 222, 128, 0.2);
  color: var(--good);
}
.stop.open {
  border-color: var(--gold);
  background: rgba(245, 197, 66, 0.12);
}
.stop.open .state {
  background: rgba(245, 197, 66, 0.24);
  color: var(--gold);
}
.stop.locked {
  opacity: 0.55;
}
.stop.locked .state {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-dim);
}
