/* ============ MedArena waitlist ============ */
:root {
  --sky: #1d9bf0;
  --sky-deep: #0b6fd6;
  --cyan: #74f2ff;
  --gold: #f7b928;
  --gold-dark: #c9831a;
  --maroon: #5e1626;
  --maroon-2: #7d2234;
  --cream: #fbf3e2;
  --cream-2: #efe1c4;
  --grass: #5cc23b;
  --grass-dark: #3a8a22;
  --red: #e2352f;
  --ink: #2a0b12;
  --text: #3a1820;
  --muted: #7a5a60;
  --px: 4px; /* one "pixel" */

  --font-pixel: "Press Start 2P", ui-monospace, monospace;
  --font-body: "Pixelify Sans", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.45;
  color: var(--text);
  background: var(--sky);
  overflow-x: hidden;
}

img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

/* ---------- Sky & parallax ---------- */
.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.sky__img {
  position: absolute;
  inset: -6%;
  background: url("assets/sky.webp") center 70% / cover no-repeat, var(--sky);
  will-change: transform;
}
.sky__rays {
  position: absolute;
  left: 50%;
  top: 55%;
  width: 220vmax;
  height: 220vmax;
  translate: -50% -50%;
  background: repeating-conic-gradient(from 0deg, rgba(255,255,255,.10) 0deg 6deg, transparent 6deg 18deg);
  mask-image: radial-gradient(circle, #000 0%, transparent 45%);
  -webkit-mask-image: radial-gradient(circle, #000 0%, transparent 45%);
  animation: spin 90s linear infinite;
}
@keyframes spin { to { rotate: 360deg; } }

.floaters { position: absolute; inset: 0; }
.floater {
  position: absolute;
  width: var(--s, 28px);
  height: var(--s, 28px);
  image-rendering: pixelated;
  will-change: transform;
  filter: drop-shadow(0 4px 0 rgba(0,0,0,.15));
}
.floater svg { width: 100%; height: 100%; animation: bob var(--d, 6s) ease-in-out infinite alternate; }
@keyframes bob { from { transform: translateY(-10px) rotate(-6deg); } to { transform: translateY(10px) rotate(6deg); } }

#fx {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 50;
  pointer-events: none;
}

/* ---------- HUD ---------- */
.hud {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px clamp(16px, 4vw, 40px) 0;
}
.hud__counter {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  font-family: var(--font-pixel);
  font-size: 10px;
  color: #fff;
  background: rgba(20, 40, 90, .45);
  backdrop-filter: blur(6px);
  border: 2px solid rgba(255,255,255,.35);
}
.hud__counter b { color: var(--gold); }
.hud__sound { margin-left: auto; }
.blink-dot {
  width: 8px; height: 8px;
  background: var(--grass);
  box-shadow: 0 0 0 2px rgba(92,194,59,.35);
  animation: blink 1.2s steps(2) infinite;
}
@keyframes blink { 50% { opacity: .2; } }

/* ---------- Layout ---------- */
.stage {
  position: relative;
  z-index: 5;
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: 0 16px 40px;
}

/* ---------- 3D logo ---------- */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: clamp(4px, 2vh, 24px);
}
.logo3d {
  position: relative;
  width: min(560px, 92vw);
  perspective: 900px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.logo3d__inner {
  position: relative;
  transform-style: preserve-3d;
  will-change: transform;
  animation: float 5s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -12px; }
}
.logo3d__img {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 10px 0 rgba(42, 11, 18, .25)) drop-shadow(0 22px 30px rgba(0, 40, 90, .35));
  transform: translateZ(40px);
}
.logo3d__shine {
  position: absolute;
  inset: 0;
  transform: translateZ(41px);
  pointer-events: none;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 30%), rgba(255,255,255,.55), transparent 38%);
  mix-blend-mode: soft-light;
  -webkit-mask: url("assets/logo.webp") center / 100% 100% no-repeat;
  mask: url("assets/logo.webp") center / 100% 100% no-repeat;
}
.logo3d__shadow {
  position: absolute;
  left: 22%;
  right: 22%;
  bottom: -26px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 30, 80, .35), transparent);
  animation: shadow 5s ease-in-out infinite;
}
@keyframes shadow { 50% { transform: scaleX(.85); opacity: .7; } }

.logo3d.is-bonk .logo3d__inner { animation: bonk .35s steps(4) 1, float 5s ease-in-out infinite .35s; }
@keyframes bonk {
  0% { scale: 1; }
  40% { scale: .94 1.06; }
  70% { scale: 1.05 .96; }
  100% { scale: 1; }
}

.tagline {
  margin: 34px 0 4px;
  font-family: var(--font-pixel);
  font-size: clamp(11px, 1.8vw, 15px);
  line-height: 1.7;
  text-align: center;
  color: #fff;
  text-shadow: 0 3px 0 var(--sky-deep), 0 0 18px rgba(0, 60, 140, .5);
}
.hint {
  margin: 0;
  font-size: 15px;
  color: rgba(255,255,255,.85);
  animation: blink 2.4s steps(2) infinite;
}

/* ---------- Pixel box ---------- */
.pixel-box {
  position: relative;
  background: var(--cream);
  border: var(--px) solid var(--maroon);
  box-shadow:
    inset 0 calc(var(--px) * -2) 0 0 var(--cream-2),
    inset 0 var(--px) 0 0 #fff,
    0 calc(var(--px) * 2) 0 0 var(--maroon),
    0 calc(var(--px) * 4) 0 0 rgba(42, 11, 18, .25);
}

/* ---------- Panel ---------- */
.panel-wrap {
  display: flex;
  justify-content: center;
  margin-top: 28px;
}
.panel {
  width: min(520px, 100%);
  padding: clamp(20px, 4vw, 32px);
}
.panel__head { text-align: center; }
.panel__title {
  margin: 12px 0 6px;
  font-family: var(--font-pixel);
  font-weight: 400;
  font-size: clamp(17px, 3.4vw, 22px);
  line-height: 1.4;
  color: var(--maroon);
  text-align: center;
}
.badge {
  display: inline-block;
  padding: 6px 10px;
  font-family: var(--font-pixel);
  font-size: 9px;
  letter-spacing: .5px;
  color: #fff;
  background: var(--red);
  box-shadow: 0 3px 0 #9b1d19;
}
.badge--gold { color: var(--ink); background: var(--gold); box-shadow: 0 3px 0 var(--gold-dark); }

.offer {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 18px 0 20px;
  padding: 12px 14px;
  font-size: 17px;
  color: var(--ink);
  background: linear-gradient(180deg, #fff3c4, #ffe28a);
  border: 3px solid var(--gold-dark);
  box-shadow: inset 0 -3px 0 rgba(201, 131, 26, .35);
}
.offer strong { color: var(--maroon); }
.offer__gift { flex: none; width: 34px; animation: wiggle 2.5s ease-in-out infinite; }
.offer__gift svg, .card__icon svg, .trophy svg { display: block; width: 100%; height: auto; }
@keyframes wiggle {
  0%, 80%, 100% { rotate: 0deg; }
  85% { rotate: -14deg; }
  90% { rotate: 12deg; }
  95% { rotate: -6deg; }
}

/* XP bar */
.xp { margin-bottom: 18px; }
.xp__label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--muted);
}
.xp__bar {
  height: 18px;
  padding: 3px;
  background: var(--ink);
}
.xp__fill {
  width: 0%;
  height: 100%;
  background:
    repeating-linear-gradient(90deg, transparent 0 10px, rgba(0,0,0,.18) 10px 12px),
    linear-gradient(180deg, #8ff06a 0 45%, var(--grass) 45% 100%);
  transition: width .5s steps(10);
}
.xp.is-full .xp__fill { animation: glow 1s steps(2) infinite; }
@keyframes glow { 50% { filter: brightness(1.25); } }

/* Fields */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  margin-bottom: 6px;
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--maroon);
}
.opt { font-family: var(--font-body); font-size: 13px; color: var(--muted); }
.field input,
.field select,
.invite input {
  width: 100%;
  padding: 12px 14px;
  font: 500 18px var(--font-body);
  color: var(--ink);
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 0;
  box-shadow: inset 0 4px 0 rgba(0,0,0,.08);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
}
.field select {
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 20px) 52%, calc(100% - 14px) 52%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
}
.field input:focus,
.field select:focus,
.invite input:focus {
  border-color: var(--sky-deep);
  box-shadow: inset 0 4px 0 rgba(0,0,0,.06), 0 0 0 4px rgba(29, 155, 240, .3);
}
.field.is-valid input { border-color: var(--grass-dark); }
.field.is-error input { border-color: var(--red); animation: shake .3s steps(4); }
.field__err {
  display: block;
  min-height: 0;
  margin-top: 4px;
  font-size: 15px;
  color: var(--red);
}
@keyframes shake {
  25% { translate: -6px 0; }
  50% { translate: 6px 0; }
  75% { translate: -3px 0; }
}

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* ---------- Pixel buttons ---------- */
.pixel-btn {
  --btn: var(--gold);
  --btn-dark: var(--gold-dark);
  --btn-text: var(--ink);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 18px;
  font-family: var(--font-pixel);
  font-size: 13px;
  line-height: 1;
  color: var(--btn-text);
  text-decoration: none;
  background: var(--btn);
  border: 0;
  cursor: pointer;
  box-shadow:
    0 -3px 0 0 var(--ink), 0 3px 0 0 var(--ink), -3px 0 0 0 var(--ink), 3px 0 0 0 var(--ink),
    inset 0 -6px 0 0 var(--btn-dark),
    inset 0 3px 0 0 rgba(255,255,255,.45),
    0 7px 0 0 var(--ink);
  transition: transform .06s, box-shadow .06s, filter .15s;
  -webkit-tap-highlight-color: transparent;
}
.pixel-btn:hover { filter: brightness(1.08); }
.pixel-btn:active,
.pixel-btn.is-pressed {
  transform: translateY(5px);
  box-shadow:
    0 -3px 0 0 var(--ink), 0 3px 0 0 var(--ink), -3px 0 0 0 var(--ink), 3px 0 0 0 var(--ink),
    inset 0 -2px 0 0 var(--btn-dark),
    inset 0 3px 0 0 rgba(255,255,255,.35),
    0 2px 0 0 var(--ink);
}
.pixel-btn:focus-visible { outline: 3px dashed #fff; outline-offset: 6px; }
.pixel-btn[disabled] { cursor: wait; filter: saturate(.6); }

.pixel-btn--small { padding: 10px 12px; font-size: 9px; }
.pixel-btn--green { --btn: var(--grass); --btn-dark: var(--grass-dark); --btn-text: #fff; }
.pixel-btn--start {
  width: 100%;
  margin-top: 10px;
  padding: 18px;
  font-size: 15px;
}
.pixel-btn--start .btn-label { animation: pulse 1.4s steps(2) infinite; }
.pixel-btn--start[disabled] .btn-label { animation: none; }
@keyframes pulse { 50% { opacity: .65; } }

.hud__sound { --btn: #fff; --btn-dark: #c9d9ea; }
.hud__sound[aria-pressed="false"] { --btn: #b8c4d2; --btn-dark: #8a98a8; }

.form-msg {
  min-height: 1.2em;
  margin: 14px 0 0;
  font-size: 16px;
  text-align: center;
  color: var(--maroon);
}
.form-msg.is-error { color: var(--red); }

.privacy {
  margin: 10px 0 0;
  font-size: 14px;
  text-align: center;
  color: var(--muted);
}

/* ---------- Success view ---------- */
#successView { text-align: center; }
#successView:not([hidden]) { animation: pop .45s steps(6); }
@keyframes pop { from { scale: .7; opacity: 0; } to { scale: 1; opacity: 1; } }
.trophy {
  width: 64px;
  margin: 0 auto 14px;
  animation: float 2.4s ease-in-out infinite;
}
.rank { margin: 6px 0; font-size: 19px; }
.rank b { font-family: var(--font-pixel); font-size: 18px; color: var(--red); }
.success-copy { margin: 8px 0 18px; }

.invite {
  padding: 16px;
  text-align: left;
  background: #fff;
  border: 3px dashed var(--maroon-2);
}
.invite__title { margin: 0 0 4px; font-family: var(--font-pixel); font-size: 11px; color: var(--maroon); }
.invite__sub { margin: 0 0 12px; font-size: 15px; color: var(--muted); }
.invite__count { margin: -4px 0 12px; font-size: 16px; }
.invite__count b { font-family: var(--font-pixel); font-size: 13px; color: var(--grass-dark); }
.invite__row { display: flex; gap: 12px; align-items: center; }
.invite__row input { flex: 1; min-width: 0; padding: 10px; font-size: 15px; }
.invite__share { display: flex; gap: 14px; margin-top: 16px; flex-wrap: wrap; }

.link-btn {
  margin-top: 16px;
  padding: 4px;
  font: 15px var(--font-body);
  color: var(--muted);
  text-decoration: underline;
  background: none;
  border: 0;
  cursor: pointer;
}
.link-btn:hover { color: var(--maroon); }

/* ---------- Power-up cards ---------- */
.powerups {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  width: min(900px, 100%);
  margin: 56px auto 0;
  perspective: 800px;
}
.card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 26px 22px 28px;
  text-align: center;
  transform-style: preserve-3d;
  transition: transform .2s ease-out;
  will-change: transform;
}
.card__icon {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin: 0 auto 12px;
  padding: 12px;
  background: var(--sky);
  box-shadow: inset 0 -5px 0 var(--sky-deep), 0 0 0 3px var(--ink);
  transform: translateZ(30px);
}
.card h3 {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3em; /* two lines, so every card's text starts at the same height */
  margin: 0 0 10px;
  line-height: 1.5;
  font-family: var(--font-pixel);
  font-size: 12px;
  font-weight: 400;
  color: var(--maroon);
  transform: translateZ(20px);
}
.card p { margin: 0; font-size: 16px; color: var(--text); }

/* ---------- Footer ---------- */
.footer {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 28px;
  text-align: center;
  font-size: 15px;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 40, 100, .35);
}
.pixel-btn--insta {
  --btn: #d62976;
  --btn-dark: #962fbf;
  --btn-text: #fff;
  margin-bottom: 18px;
  font-size: 10px;
  background: linear-gradient(135deg, #feda75, #fa7e1e 25%, #d62976 55%, #962fbf 80%, #4f5bd5);
  text-shadow: 0 2px 0 rgba(0,0,0,.25);
}
.pixel-btn--insta svg { width: 18px; height: 18px; flex: none; }
.footer p {
  display: inline-block;
  margin: 0;
  padding: 6px 12px;
  background: rgba(20, 40, 90, .45);
  backdrop-filter: blur(6px);
}

/* ---------- Toasts ---------- */
.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(320px, calc(100vw - 32px));
  padding: 12px 14px;
  color: #fff;
  background: #1c1424;
  border: 3px solid var(--gold);
  box-shadow: 0 6px 0 rgba(0,0,0,.3);
  animation: toastIn .35s steps(5), toastOut .35s steps(5) forwards var(--out, 3.4s);
}
.toast__icon { font-size: 26px; }
.toast__k { display: block; font-family: var(--font-pixel); font-size: 8px; color: var(--gold); margin-bottom: 4px; }
.toast__v { display: block; font-size: 16px; }
@keyframes toastIn { from { translate: 110% 0; } }
@keyframes toastOut { to { translate: 110% 0; opacity: 0; } }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .powerups { grid-template-columns: 1fr; gap: 18px; width: min(528px, 100%); }
  .card h3 { min-height: 0; }
}
@media (max-width: 480px) {
  body { font-size: 17px; }
  .hud__counter { font-size: 8px; padding: 6px 10px; }
  .hint { font-size: 13px; }
  .pixel-btn--start { font-size: 13px; }
  .invite__row { flex-direction: column; align-items: stretch; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
