/* Motion and landing layer. Every animation respects prefers-reduced-motion. */
#fx {
  position: fixed;
  left: 50%;
  bottom: 22%;
  width: 0;
  height: 0;
  z-index: 80;
  pointer-events: none;
}
.fx-coin,
.fx-confetti {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
}
.fx-coin {
  width: 12px;
  height: 12px;
  background: #f7d23e;
  border: 2px solid #1b1b24;
  box-shadow: inset -3px -3px 0 #c99a2e;
}
.fx-confetti {
  width: 8px;
  height: 8px;
  background: hsl(var(--h) 85% 58%);
}
.loading-dots::after {
  content: '...';
}
.guide {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 45;
  width: min(330px, calc(100vw - 40px));
  background: var(--panel);
  border: 3px solid var(--ink);
  box-shadow: 6px 6px 0 color-mix(in srgb, var(--ink) 30%, transparent);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.guide-step {
  font-family: var(--pixel);
  font-size: 13px;
  color: var(--ink-2);
}
.guide-title {
  font-family: var(--pixel);
  font-size: 19px;
  font-weight: 700;
}
.guide-how {
  font-size: 14px;
}
.guide-ready {
  border-color: var(--ok);
}
.tut-progress {
  display: flex;
  align-items: center;
  gap: 14px;
}
.tut-progress .meter {
  flex: 1;
  height: 16px;
}
.tut-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}
.tut-step {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 4px 14px;
  align-items: center;
  border: 2px solid var(--ink);
  background: var(--street);
  padding: 12px 14px;
}
.tut-num {
  grid-row: span 2;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  font-family: var(--pixel);
  font-size: 22px;
  font-weight: 700;
  border: 3px solid var(--ink);
  background: var(--paper);
}
.tut-step.done .tut-num {
  background: var(--ok);
  color: #fff;
}
.tut-step.claimed {
  opacity: 0.6;
}
.tut-step.current {
  border-color: var(--lux);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--lux) 45%, transparent);
}
.tut-step h3 {
  font-family: var(--pixel);
}
.tut-step p {
  grid-column: 2;
  font-size: 15px;
  color: var(--ink-2);
}
.tut-step .row-actions {
  grid-column: 3;
  grid-row: 1 / span 2;
}
.earn-map {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.earn-card {
  border: 2px solid var(--ink);
  background: color-mix(in srgb, var(--zone, var(--ind)) 18%, var(--panel));
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.earn-card strong {
  font-family: var(--pixel);
  font-size: 18px;
}

/* Landing ------------------------------------------------------------------------------------- */
.landing {
  display: flex;
  flex-direction: column;
  gap: 36px;
}
.landing-hero {
  position: relative;
  overflow: hidden;
  border: 3px solid var(--ink);
  box-shadow: 8px 8px 0 color-mix(in srgb, var(--ink) 30%, transparent);
  min-height: min(78vh, 620px);
  display: flex;
  align-items: flex-end;
  background: #2b2f3a;
}
.landing-hero canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}
.landing-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(16, 20, 56, 0) 30%, rgba(16, 20, 56, 0.82) 100%);
}
.landing-copy {
  position: relative;
  z-index: 2;
  padding: clamp(18px, 4vw, 44px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  color: #fff;
  max-width: 820px;
}
.landing-title {
  font-family: var(--pixel);
  font-size: clamp(40px, 8vw, 92px);
  line-height: 0.95;
  font-weight: 700;
  text-shadow: 4px 4px 0 #1b1b24;
}
.landing-title .w {
  display: inline-block;
}
.landing-title .gold {
  color: #f7d23e;
}
.landing-copy .lede {
  color: #e9ecf3;
  font-size: clamp(16px, 2vw, 20px);
  max-width: 60ch;
}
.landing-copy .btn-ghost {
  color: #fff;
  border-color: #fff;
}
.float-coins i {
  position: absolute;
  z-index: 1;
  width: 14px;
  height: 14px;
  background: #f7d23e;
  border: 2px solid #1b1b24;
  box-shadow: inset -3px -3px 0 #c99a2e;
  left: var(--l);
  bottom: -20px;
}
.stat-band {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.stat {
  border: 3px solid var(--ink);
  background: var(--panel);
  padding: 14px 16px;
}
.stat b {
  display: block;
  font-family: var(--pixel);
  font-size: clamp(28px, 4vw, 40px);
  font-variant-numeric: tabular-nums;
}
.stat span {
  color: var(--ink-2);
}
.how {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  counter-reset: how;
}
.how li {
  list-style: none;
  counter-increment: how;
  border: 3px solid var(--ink);
  background: var(--street);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.how li::before {
  content: counter(how);
  font-family: var(--pixel);
  font-size: 30px;
  font-weight: 700;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: #f7d23e;
  border: 3px solid var(--ink);
}
.how li strong {
  font-family: var(--pixel);
  font-size: 20px;
}
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}
.feature {
  border: 2px solid var(--ink);
  border-top: 8px solid var(--zone);
  background: var(--panel);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.feature strong {
  font-family: var(--pixel);
  font-size: 19px;
}
.ticker {
  overflow: hidden;
  border-block: 3px solid var(--ink);
  background: #1b1b24;
  color: #f7d23e;
  font-family: var(--pixel);
  white-space: nowrap;
}
.ticker-track {
  display: inline-flex;
  gap: 48px;
  padding: 10px 0;
}
.cta-band {
  border: 3px solid var(--ink);
  background: color-mix(in srgb, var(--lux) 28%, var(--panel));
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.cta-band h2 {
  font-size: clamp(24px, 3vw, 34px);
}
.reveal {
  opacity: 1;
}

@media (prefers-reduced-motion: no-preference) {
  .page-enter > * {
    animation: page-in 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  }
  .page-enter :is(.panel, .item, .fit, .menu-item, .job, .recipe, .contract, .tut-step, .earn-card) {
    animation: rise 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  }
  .page-enter :is(.panel, .tut-step, .item, .fit):nth-child(2) { animation-delay: 0.05s; }
  .page-enter :is(.panel, .tut-step, .item, .fit):nth-child(3) { animation-delay: 0.1s; }
  .page-enter :is(.panel, .tut-step, .item, .fit):nth-child(4) { animation-delay: 0.15s; }
  .page-enter :is(.panel, .tut-step, .item, .fit):nth-child(5) { animation-delay: 0.2s; }
  .page-enter :is(.panel, .tut-step, .item, .fit):nth-child(n + 6) { animation-delay: 0.25s; }
  .btn {
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  }
  .btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 0 color-mix(in srgb, var(--ink) 40%, transparent);
  }
  .btn-primary {
    position: relative;
    overflow: hidden;
  }
  .btn-primary::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 30%;
    left: -40%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    transform: skewX(-20deg);
  }
  .btn-primary:not(:disabled):hover::after {
    animation: shine 0.7s ease;
  }
  .btn.is-busy {
    animation: busy 0.6s steps(2) infinite;
  }
  .nav-item {
    transition: transform 0.12s ease, background 0.12s ease;
  }
  .nav-item:hover {
    transform: translateX(4px);
  }
  .nav-item:hover .zone-chip {
    animation: chip 0.5s steps(2) 2;
  }
  :is(.item, .fit, .menu-item, .recipe, .contract, .feature, .earn-card, .how li) {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
  }
  :is(.item, .fit, .menu-item, .recipe, .contract, .feature, .earn-card, .how li):hover {
    transform: translateY(-4px);
    box-shadow: 6px 8px 0 color-mix(in srgb, var(--ink) 25%, transparent);
  }
  .meter-ind .meter-fill,
  .meter-civ .meter-fill {
    background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.28) 0 6px, transparent 6px 12px);
    background-size: 17px 17px;
    animation: stripes 0.9s linear infinite;
  }
  .toast {
    animation: toast-in 0.4s cubic-bezier(0.2, 1.4, 0.4, 1) both;
  }
  .toast-out {
    animation: toast-out 0.4s ease both;
  }
  .guide {
    animation: guide-in 0.55s cubic-bezier(0.2, 1.4, 0.4, 1) both;
  }
  .guide-ready {
    animation: guide-in 0.55s cubic-bezier(0.2, 1.4, 0.4, 1) both, glow 1.6s ease-in-out 0.6s infinite;
  }
  .tut-step.current .tut-num {
    animation: bounce 1.2s ease-in-out infinite;
  }
  .boot-mark rect {
    animation: tile 1s steps(2) infinite;
  }
  .boot-mark rect:nth-child(2) { animation-delay: 0.25s; }
  .boot-mark rect:nth-child(3) { animation-delay: 0.5s; }
  .boot-mark rect:nth-child(4) { animation-delay: 0.75s; }
  .loading-dots::after {
    animation: dots 1.2s steps(4) infinite;
    display: inline-block;
    width: 1.5em;
    overflow: hidden;
    vertical-align: bottom;
  }
  .fx-coin {
    animation: fly 1.3s cubic-bezier(0.2, 0.7, 0.3, 1) var(--d) both;
  }
  .fx-confetti {
    animation: fly 1.5s cubic-bezier(0.2, 0.7, 0.3, 1) var(--d) both, spin 0.5s linear infinite;
  }
  .landing-title .w {
    animation: pop 0.6s cubic-bezier(0.2, 1.6, 0.4, 1) both;
    animation-delay: calc(var(--i) * 0.09s + 0.15s);
  }
  .landing-copy > :not(.landing-title) {
    animation: rise 0.6s ease both 0.7s;
  }
  .float-coins i {
    animation: float-up var(--t) linear var(--d) infinite;
  }
  .ticker-track {
    animation: marquee 40s linear infinite;
  }
  .reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  .reveal.in {
    opacity: 1;
    transform: none;
  }
  .how li:nth-child(2).reveal { transition-delay: 0.08s; }
  .how li:nth-child(3).reveal { transition-delay: 0.16s; }
  .how li:nth-child(4).reveal { transition-delay: 0.24s; }
  .hud-rush {
    animation: pulse-red 1.4s ease-in-out infinite;
  }
  .avatar.pixel:hover {
    animation: hop 0.4s steps(2);
  }
}
@keyframes page-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes shine { to { left: 120%; } }
@keyframes busy { 50% { opacity: 0.55; } }
@keyframes chip { 50% { transform: scale(1.4) rotate(45deg); } }
@keyframes stripes { to { background-position: 17px 0; } }
@keyframes toast-in { from { opacity: 0; transform: translateX(40px) scale(0.9); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(40px); } }
@keyframes guide-in { from { opacity: 0; transform: translateY(30px) scale(0.95); } }
@keyframes glow { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--ok) 35%, transparent), 6px 6px 0 rgba(0, 0, 0, 0.3); } }
@keyframes bounce { 50% { transform: translateY(-5px); } }
@keyframes tile { 50% { opacity: 0.35; } }
@keyframes dots { from { width: 0; } }
@keyframes fly { 0% { transform: translate(0, 0) scale(0.6); opacity: 1; } 70% { opacity: 1; } 100% { transform: translate(var(--x), var(--y)) scale(1); opacity: 0; } }
@keyframes spin { to { rotate: 360deg; } }
@keyframes pop { from { opacity: 0; transform: translateY(40px) scale(0.6) rotate(-6deg); } }
@keyframes float-up { from { transform: translateY(0) rotate(0); opacity: 0; } 10% { opacity: 1; } to { transform: translateY(-700px) rotate(360deg); opacity: 0; } }
@keyframes marquee { to { transform: translateX(-50%); } }
@keyframes pulse-red { 50% { filter: brightness(1.25); } }
@keyframes hop { 50% { transform: translateY(-3px); } }

@media (max-width: 860px) {
  .guide {
    left: 10px;
    right: 10px;
    width: auto;
    bottom: calc(64px + env(safe-area-inset-bottom));
  }
  .tut-step {
    grid-template-columns: 44px minmax(0, 1fr);
  }
  .tut-step .row-actions {
    grid-column: 1 / -1;
    grid-row: auto;
  }
  .landing-hero {
    min-height: 520px;
  }
}
/* brand mark used in the shell header */
.brand-mark {
  width: 26px;
  height: 26px;
  background: conic-gradient(var(--ind) 0 25%, var(--com) 0 50%, var(--res) 0 75%, var(--civ) 0);
  border: 2px solid var(--ink);
  flex: none;
}
[hidden] {
  display: none !important;
}
