:root {
  --navy: #0d1a12;
  --card: #14261c;
  --gold: #8fd46a;
  --gold-2: #6bb34f;
  --cream: #e8f0d8;
  --muted: #8aa392;
  --soft: #cfe0c8;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--navy); color: var(--cream); font-family: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif; }
body { overflow: hidden; }
button, input { font: inherit; color: inherit; }

#sky {
  position: relative;
  min-height: 100%;
  min-height: 100dvh;
  background:
    radial-gradient(ellipse at 50% 38%, #163322 0%, var(--navy) 62%);
  display: flex;
  flex-direction: column;
}

.stars {
  position: absolute; inset: 0;
  background-image:
    radial-gradient(1px 1px at 12% 18%, #fff8, transparent),
    radial-gradient(1px 1px at 28% 72%, #fff6, transparent),
    radial-gradient(1.5px 1.5px at 67% 22%, #fff9, transparent),
    radial-gradient(1px 1px at 81% 64%, #fff5, transparent),
    radial-gradient(1px 1px at 44% 12%, #fff7, transparent),
    radial-gradient(1.2px 1.2px at 90% 40%, #fff6, transparent),
    radial-gradient(1px 1px at 8% 88%, #fff5, transparent),
    radial-gradient(1px 1px at 55% 80%, #fff6, transparent);
  pointer-events: none;
}

.weather { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.weather.aurora {
  box-shadow: inset 0 -45vh 120px #7eb8a888, inset 0 20vh 80px #8fd46a33;
  animation: auroraPulse 3s ease-in-out infinite alternate;
}
.weather.aurora .flake {
  position: absolute; width: 6px; height: 6px; background: #b7f0d8; border-radius: 50%;
  box-shadow: 0 0 10px #7eb8a8;
  animation: fall 3.2s linear forwards;
}
@keyframes auroraPulse {
  from { filter: saturate(1); }
  to { filter: saturate(1.6) brightness(1.15); }
}
.weather.stars-burst .flake {
  position: absolute; width: 3px; height: 3px; background: var(--gold); border-radius: 50%;
  animation: fall 2.4s linear forwards;
}
.weather.rain .flake {
  position: absolute; width: 1px; height: 18px; background: #8aa392aa;
  animation: fall 1.1s linear forwards;
}
@keyframes fall { to { transform: translateY(110vh); opacity: 0; } }

.top {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(16px + env(safe-area-inset-top)) 22px 0;
}
.wordmark {
  letter-spacing: 0.38em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--gold);
  font-family: ui-sans-serif, system-ui, sans-serif;
}
.glow-pill {
  position: relative;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid #8fd46a44;
  border-radius: 999px;
  padding: 6px 12px 6px 14px;
  overflow: hidden;
  display: flex;
  gap: 8px;
  align-items: center;
}
.glow-pill i {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 8%;
  background: linear-gradient(90deg, #8fd46a22, #8fd46a55);
  z-index: -1;
  transition: width 0.8s ease;
}

.stage {
  flex: 1;
  position: relative;
  display: grid;
  place-items: center;
}
.bug {
  position: relative;
  width: 96px; height: 96px;
  border: 0; background: none; cursor: pointer;
  animation: drift 7s ease-in-out infinite;
}
.bug.dance { animation: dance 0.38s ease-in-out 14; }
.bug.asleep { animation: none; filter: grayscale(0.45) brightness(0.45); }
.bug.asleep .wing { animation: none; }
.bug.hot .halo { inset: -34px; opacity: 1; }
.bug.lit .core { box-shadow: 0 0 48px 22px #8fd46aee; }
.bug.trail::after {
  content: "";
  position: absolute; inset: 20px;
  border-radius: 50%;
  background: #8fd46a55;
  filter: blur(10px);
  animation: drift 1.6s ease-in-out infinite reverse;
}
.halo {
  position: absolute; inset: -26px;
  border-radius: 50%;
  background: radial-gradient(circle, #8fd46acc 0%, transparent 68%);
  animation: pulse 2.2s ease-in-out infinite;
}
.core {
  position: absolute; inset: 30px;
  border-radius: 50%;
  background: #fff6d4;
  box-shadow: 0 0 32px 14px #8fd46add;
}
.wing {
  position: absolute; top: 22px; width: 22px; height: 28px;
  background: #8fd46a33;
  border: 1px solid #8fd46a55;
  border-radius: 70% 70% 40% 40%;
  filter: blur(0.2px);
}
.wing.left { left: 8px; transform: rotate(-28deg); animation: flap 0.7s ease-in-out infinite; }
.wing.right { right: 8px; transform: rotate(28deg); animation: flap 0.7s ease-in-out infinite reverse; }
@keyframes drift {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(10px, -16px); }
}
@keyframes pulse {
  0%, 100% { opacity: 0.65; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.08); }
}
@keyframes flap {
  50% { transform: rotate(0deg) scaleY(0.85); }
}
@keyframes dance {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  25% { transform: translate(18px, -22px) rotate(12deg); }
  50% { transform: translate(-10px, -8px) rotate(-8deg); }
  75% { transform: translate(8px, -28px) rotate(6deg); }
}

.fx { position: absolute; inset: 0; pointer-events: none; }
.spark {
  position: absolute; left: 50%; top: 50%;
  width: 7px; height: 7px; margin: -3px; border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px #8fd46a;
  animation: spark 0.9s ease-out forwards;
}
.spark.big { width: 11px; height: 11px; margin: -5px; background: #fff6d4; }
.ring {
  position: absolute; left: 50%; top: 50%;
  width: 20px; height: 20px; margin: -10px;
  border: 2px solid #8fd46aaa;
  border-radius: 50%;
  animation: ring 1.1s ease-out forwards;
}
@keyframes spark {
  to { transform: translate(var(--x), var(--y)) scale(0.2); opacity: 0; }
}
@keyframes ring {
  to { transform: scale(9); opacity: 0; }
}
#sky.dawn {
  background:
    radial-gradient(ellipse at 50% 70%, #6bb34f66 0%, #163322 45%, var(--navy) 70%);
}

.bubble {
  position: absolute;
  top: calc(50% + 58px);
  max-width: 240px;
  padding: 8px 12px;
  border-radius: 14px;
  background: #14261cee;
  border: 1px solid #8fd46a33;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 13px;
  color: var(--cream);
  text-align: center;
}
.bubble.hidden { display: none; }
.status {
  position: absolute;
  top: calc(50% + 78px);
  width: min(280px, 86vw);
  text-align: center;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.status.combo { color: var(--gold); }
.status.sleep { color: #7d86a3; }
.plaque, .tender, .book, .toast {
  font-family: ui-sans-serif, system-ui, sans-serif;
  text-align: center;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.plaque {
  position: absolute;
  top: calc(50% - 92px);
  font-size: 10px;
  color: var(--gold);
}
.tender {
  position: absolute;
  top: calc(50% + 58px);
  font-size: 11px;
  color: var(--gold);
}
.book {
  position: absolute;
  top: calc(50% + 102px);
  max-width: 280px;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--cream);
  opacity: 0.9;
}
.toast {
  position: relative;
  z-index: 4;
  font-size: 11px;
  color: var(--gold);
  padding: 0 16px 8px;
}
.plaque.hidden, .tender.hidden, .book.hidden, .toast.hidden { display: none; }
.pill.heat { border-color: var(--gold); }

.pills {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 16px 12px;
  min-height: 36px;
}
.pill {
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 12px;
  color: var(--soft);
  border: 1px solid #8fd46a33;
  background: #0d1a12aa;
  border-radius: 999px;
  padding: 6px 10px;
}
.pill b { color: var(--gold); font-weight: 600; }

.dock {
  position: relative;
  z-index: 3;
  padding: 8px 16px calc(18px + env(safe-area-inset-bottom));
}
.actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  border: 1px solid #8fd46a28;
  background: #0d1f14cc;
  border-radius: 22px;
  padding: 10px;
  backdrop-filter: blur(12px);
}
.actions button {
  background: none; border: 0; cursor: pointer;
  color: var(--gold);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 16px;
  padding: 10px 0 6px;
}
.actions button span {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #6bb34f;
}
.more {
  display: block;
  width: 100%;
  margin-top: 8px;
  background: none; border: 0; cursor: pointer;
  color: var(--gold);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 10px;
  font-family: ui-sans-serif, system-ui, sans-serif;
  padding: 8px;
}

.overlay {
  position: fixed; inset: 0; z-index: 10;
  background: #06140acc;
  display: grid;
  align-items: end;
  justify-items: center;
}
.overlay.hidden { display: none; }
.sheet {
  width: min(440px, 100%);
  background: #132418;
  border-top: 1px solid #8fd46a33;
  border-radius: 24px 24px 0 0;
  padding: 10px 20px 28px;
}
.sheet-handle {
  width: 42px; height: 4px; border-radius: 4px;
  background: #2a4a34; margin: 6px auto 16px;
}
.sheet h2 {
  font-weight: 500;
  font-size: 26px;
  margin-bottom: 14px;
}
.field {
  display: flex; flex-direction: column; gap: 6px;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}
.field input {
  background: #0d1a12;
  border: 1px solid #2a4a34;
  border-radius: 12px;
  padding: 12px 14px;
  letter-spacing: 0;
  text-transform: none;
  font-size: 16px;
  color: var(--cream);
}
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 8px 0 16px;
}
.grid button {
  background: #0d1a12;
  border: 1px solid #8fd46a33;
  border-radius: 14px;
  padding: 14px 10px;
  cursor: pointer;
  color: var(--gold);
  font-family: ui-sans-serif, system-ui, sans-serif;
}
.grid button small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
  font-size: 11px;
}
.ghost, .primary {
  width: 100%;
  border-radius: 14px;
  padding: 12px;
  cursor: pointer;
  font-family: ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 11px;
  text-align: center;
  text-decoration: none;
  display: block;
  margin-top: 8px;
}
.ghost { background: none; border: 1px solid #2a4a34; color: var(--muted); }
.primary { background: var(--gold); border: 0; color: #0d1a12; font-weight: 700; }
.primary.hidden { display: none; }
.pay-sheet { text-align: center; }
.pay-kicker {
  font-family: ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0.2em;
  font-size: 11px;
  color: var(--gold);
  margin-bottom: 6px;
}
#qr {
  width: 220px; height: 220px;
  border-radius: 16px;
  margin: 8px auto 10px;
  background: var(--cream);
  display: grid;
  place-items: center;
  overflow: hidden;
}
#qr canvas { display: block; }
.hint, .timer {
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 12px;
  color: var(--muted);
}
.pay-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pay-row .ghost { margin-top: 0; }
.timer { margin-top: 10px; }

.reeds {
  position: absolute; inset: auto 0 0 0; height: 22vh;
  background:
    linear-gradient(to top, #07140c 0%, transparent 100%),
    repeating-linear-gradient(90deg, transparent 0 18px, #1d3a24aa 18px 20px);
  pointer-events: none; opacity: 0.45;
}
.pepe {
  position: relative;
  width: 210px; height: 210px;
  border: 0; background: none; cursor: pointer;
  animation: drift 6s ease-in-out infinite;
}
.pepe .face { width: 100%; height: 100%; overflow: visible; }
.pepe .head, .pepe .cheek { fill: #5aa64b; }
.pepe .eye-white { fill: #e8f0d8; }
.pepe .pupil { fill: #1a2418; }
.pepe .lid { fill: none; stroke: #3d7a38; stroke-width: 3; opacity: 0; }
.pepe .brow { fill: none; stroke: #2d4a28; stroke-width: 3; stroke-linecap: round; }
.pepe .mouth { fill: none; stroke: #2d4a28; stroke-width: 4; stroke-linecap: round; }
.pepe .shades { fill: #111; opacity: 0; }
.pepe .halo-rare { fill: none; stroke: #d4f08a; stroke-width: 3; opacity: 0; }
.pepe.asleep { animation: none; filter: grayscale(0.35) brightness(0.55); }
.pepe.asleep .pupil { transform: scaleY(0.15); transform-origin: center; }
.pepe.hot { filter: drop-shadow(0 0 18px #8fd46a); }
.pepe.lit { filter: drop-shadow(0 0 28px #b6f08a); }
.pepe.smirk .mouth { d: path("M78 138 Q100 146 128 132"); }
.pepe.happy .mouth { d: path("M70 134 Q100 158 130 134"); }
.pepe.happy .eye-white { transform: scaleY(0.85); }
.pepe.dance { animation: pepedance 0.35s ease-in-out 16; }
.pepe.shy .mouth { d: path("M88 142 Q100 138 112 142"); }
.pepe.shy .cheek { fill: #7ec45a; }
.pepe.reee .mouth { d: path("M74 132 Q100 172 126 132"); stroke-width: 5; }
.pepe.reee .brow { transform: translateY(-4px); }
.pepe.cool .shades { opacity: 1; }
.pepe.rare .halo-rare { opacity: 1; }
.pepe.rare .head { fill: #6ed35a; }
.pepe.god .head { fill: #d4e07a; }
.pepe.god .halo-rare { opacity: 1; stroke: #fff6d4; }
@keyframes pepedance {
  0%, 100% { transform: translate(0,0) rotate(0); }
  25% { transform: translate(16px,-18px) rotate(8deg); }
  50% { transform: translate(-14px,-6px) rotate(-10deg); }
  75% { transform: translate(8px,-22px) rotate(5deg); }
}
.name-dock {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 8px;
}
.name-dock input {
  width: 120px; background: #0d1a12; border: 1px solid #2a4a34;
  border-radius: 999px; padding: 6px 10px; color: var(--cream);
  letter-spacing: 0; text-transform: none; font-size: 13px;
}

.chapter {
  position: absolute;
  top: calc(50% - 118px);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
}
.pepe.sit { transform: translateY(18px) scale(0.92); }
.pepe.sit .brow { transform: translateY(6px); }
.pepe.sit .mouth { d: path("M88 144 Q100 140 112 144"); }
.pepe.stand { transform: translateY(0) scale(1); }
.pepe.scream .mouth { d: path("M72 130 Q100 176 128 130"); }
.pepe.scream { filter: drop-shadow(0 0 22px #8fd46a); }
.pepe.lord { filter: drop-shadow(0 0 34px #fff6d4); }
.pepe.lord .halo-rare { opacity: 1; stroke: #fff6d4; }
.pepe.lord .head { fill: #cfe07a; }
body.ending #sky {
  background: radial-gradient(ellipse at 50% 40%, #3a5a28 0%, #0d1a12 70%);
}
body.ending .pepe { animation: pepedance 0.4s ease-in-out infinite; }
