:root {
  /* Peter & Sons brand palette (from partner-portal theme) */
  --purple-darkest: #251E34;
  --blue-dark: #1c1f39;
  --blue-med: #282e4e;
  --surface-300: #2e3458;
  --surface-400: #353b62;
  --surface-600: #434a76;
  --gold: #FFC900;
  --gold-hover: #E6B800;
  --gold-soft: rgba(255, 201, 0, 0.16);
  --white: #ffffff;
  --muted: rgba(255, 255, 255, 0.62);
  --border: rgba(255, 255, 255, 0.12);

  --font-display: "Unbounded", sans-serif;
  --font-body: "Manrope", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}
html { scroll-behavior: smooth; }
#play { scroll-margin-top: 1.5rem; }

body {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.25rem, 4vw, 3rem);
  font-family: var(--font-body);
  color: var(--white);
  background:
    radial-gradient(1200px 800px at 80% -10%, #2e2545 0%, transparent 55%),
    radial-gradient(900px 700px at 5% 110%, #1a2140 0%, transparent 50%),
    var(--purple-darkest);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* Atmospheric glows */
.glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
}
.glow--gold {
  width: 460px; height: 460px;
  top: -160px; right: -120px;
  background: radial-gradient(circle, rgba(255, 201, 0, 0.35), transparent 70%);
  animation: drift 16s ease-in-out infinite alternate;
}
.glow--violet {
  width: 520px; height: 520px;
  bottom: -220px; left: -160px;
  background: radial-gradient(circle, rgba(88, 95, 148, 0.55), transparent 70%);
  animation: drift 20s ease-in-out infinite alternate-reverse;
}
@keyframes drift {
  from { transform: translate(0, 0); }
  to   { transform: translate(40px, 30px); }
}

/* Subtle grain */
.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.4;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}

.stage {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1040px;
  display: grid;
  grid-template-columns: 1fr minmax(360px, 460px);
  align-items: center;
  gap: clamp(2rem, 5vw, 4rem);
  animation: rise 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.panel--info {
  display: flex;
  flex-direction: column;
  gap: clamp(1.5rem, 3vw, 2.25rem);
}
.panel--game { width: 100%; }

/* Desktop: cap the game to the viewport height so the page never scrolls.
   Canvas is 4:5, so bounding its width by viewport height keeps the whole
   card (HUD + canvas + hint) inside the fold. */
@media (min-width: 881px) {
  .panel--game {
    max-width: min(460px, 52vh);
    margin-inline: auto;
  }
}

/* CTA button that jumps to the game — desktop shows the game already, so
   this is only needed on the stacked mobile layout. */
.btn--cta {
  display: none;
  text-decoration: none;
  align-self: flex-start;
  margin-top: 0.5rem;
}

/* Stacked layout: text on top, game underneath, CTA visible */
@media (max-width: 880px) {
  body { align-items: flex-start; }
  .stage {
    grid-template-columns: 1fr;
    gap: clamp(1.75rem, 6vw, 2.5rem);
    max-width: 560px;
  }
  .btn--cta { display: inline-block; }
}

/* Masthead */
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.logo { width: 128px; height: auto; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--gold);
  background: var(--gold-soft);
  border: 1px solid rgba(255, 201, 0, 0.3);
  border-radius: 999px;
  white-space: nowrap;
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 0 rgba(255, 201, 0, 0.6);
  animation: pulse 1.8s ease-out infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255, 201, 0, 0.55); }
  70%  { box-shadow: 0 0 0 8px rgba(255, 201, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 201, 0, 0); }
}

/* Intro copy */
.headline {
  margin: 0;
  font-family: var(--font-display);
  line-height: 0.98;
  display: flex;
  flex-direction: column;
}
.headline__small {
  font-size: clamp(1.1rem, 4vw, 1.5rem);
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.01em;
}
.headline__big {
  font-size: clamp(2.6rem, 11vw, 4.25rem);
  font-weight: 900;
  letter-spacing: -0.01em;
  background: linear-gradient(100deg, #ffffff 0%, #ffe58a 45%, var(--gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 6px 40px rgba(255, 201, 0, 0.15);
}
.subhead {
  margin: 1rem 0 0;
  max-width: 46ch;
  font-size: clamp(0.95rem, 2.5vw, 1.05rem);
  line-height: 1.6;
  color: var(--muted);
}

/* Game frame */
.game__frame {
  background: linear-gradient(180deg, var(--blue-dark), #171a30);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 0.85rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.game__hud {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0.35rem 0.6rem 0.9rem;
}
.hud-item { display: flex; flex-direction: column; gap: 2px; }
.hud-item--right { align-items: flex-end; }
.hud-label {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.hud-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
  font-variant-numeric: tabular-nums;
}
.hud-value--gold { color: var(--gold); }
.hud-title { text-align: center; display: flex; flex-direction: column; }
.hud-title__kicker {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
}
.hud-title__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--gold);
}

/* Canvas */
.game__canvas-wrap {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% 0%, #20243f 0%, #14172b 100%);
  border: 1px solid var(--border);
  touch-action: none;
}
#game {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  cursor: none;
}

.lives {
  position: absolute;
  top: 10px; left: 12px;
  display: flex;
  gap: 5px;
}
.life {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff3bf, var(--gold));
  box-shadow: 0 0 8px rgba(255, 201, 0, 0.5);
  transition: transform 0.25s, opacity 0.25s;
}
.life.lost {
  background: var(--surface-400);
  box-shadow: none;
  opacity: 0.4;
  transform: scale(0.8);
}

/* Overlay */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(20, 23, 43, 0.82);
  backdrop-filter: blur(6px);
  transition: opacity 0.3s ease;
}
.overlay[data-state="playing"] {
  opacity: 0;
  pointer-events: none;
}
.overlay__card { text-align: center; max-width: 320px; }
.overlay__title {
  margin: 0 0 0.6rem;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(1.8rem, 7vw, 2.4rem);
  color: var(--gold);
}
.overlay__text {
  margin: 0 0 1.4rem;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--muted);
}

/* Buttons */
.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: #1a1400;
  background: linear-gradient(180deg, #ffe27a, var(--gold));
  padding: 0.85rem 2rem;
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(255, 201, 0, 0.3);
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.btn:hover {
  background: linear-gradient(180deg, #ffea94, var(--gold-hover));
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(255, 201, 0, 0.4);
}
.btn:active { transform: translateY(0); }

/* Footer */
.game__hint {
  margin: 0.85rem 0.4rem 0;
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
}
.footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.link-btn {
  appearance: none;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gold);
  padding: 0.2rem 0;
  transition: color 0.15s;
}
.link-btn:hover { color: var(--gold-hover); text-decoration: underline; }

@media (max-width: 520px) {
  .logo { width: 104px; }
  #game { cursor: default; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .glow, .status-dot, .stage { animation: none; }
}
