/* Panic Stack website. Colors match the game's Palette.swift and BlockColor.swift. */
:root {
  --navy-900: #060c2a;
  --navy-800: #0b1440;
  --navy-700: #15307c;
  --purple-800: #2a1170;
  --purple-700: #3b1a93;
  --card: #1a0f4f;
  --text: #ffffff;
  --text-dim: rgba(255, 255, 255, 0.78);
  --gold: #ffc83a;
  --sky: #5ce1ff;
  --red: #ff3b4e;
  --yellow: #ffc22b;
  --green: #2fcb55;
  --blue: #2f86ff;
  --purple: #a34bff;
  --radius: 22px;
  --max: 1120px;
  --font: "Avenir Next", "Avenir", "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--navy-900);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: var(--sky); }
a:focus-visible, button:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 8px; }

.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  background: var(--gold); color: var(--navy-900); padding: 10px 16px; border-radius: 10px;
  font-weight: 800; text-decoration: none;
}
.skip-link:focus { top: 12px; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 20px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(6, 12, 42, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(91, 134, 255, 0.18);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 72px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; font-weight: 800; font-size: 1.6rem; letter-spacing: -0.01em; }
.brand img { width: 48px; height: 48px; border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,.4); }

.nav ul { display: flex; gap: 32px; list-style: none; margin: 0; padding: 0; }
.nav a { color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.02rem; }
.nav a:hover { color: var(--gold); }

.nav-toggle {
  display: none; background: none; border: 2px solid rgba(255,255,255,.35); color: var(--text);
  border-radius: 12px; padding: 8px 14px; font: inherit; font-weight: 700; cursor: pointer;
}

@media (max-width: 720px) {
  .brand { font-size: 1.3rem; }
  .brand img { width: 40px; height: 40px; }
  .nav-toggle { display: block; }
  .nav { position: absolute; top: 72px; left: 0; right: 0; background: var(--navy-800); border-bottom: 1px solid rgba(91,134,255,.25); display: none; }
  .nav.open { display: block; }
  .nav ul { flex-direction: column; gap: 0; padding: 8px 20px 16px; }
  .nav a { display: block; padding: 12px 0; font-size: 1.1rem; }
  .no-js .nav { display: block; position: static; background: none; border: 0; }
  .no-js .nav-toggle { display: none; }
}

/* ---------- Space backgrounds ---------- */
.space {
  position: relative; overflow: hidden;
  background:
    radial-gradient(ellipse 60% 40% at 80% 20%, rgba(124, 58, 237, .35), transparent 70%),
    radial-gradient(ellipse 50% 40% at 10% 30%, rgba(59, 26, 147, .45), transparent 70%),
    linear-gradient(180deg, #050a24 0%, #0a1240 100%);
}
.stars, .stars::after {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 22% 62%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 35% 12%, #cfe3ff 50%, transparent 51%),
    radial-gradient(1px 1px at 48% 40%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 58% 8%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 66% 52%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 78% 30%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 66%, #cfe3ff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 94% 14%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 5% 45%, #fff 50%, transparent 51%);
}
.stars::after { content: ""; transform: translate(37px, 53px) scale(1.4); opacity: .6; }

/* Earth horizon, drawn with gradients (original artwork) */
.horizon {
  position: absolute; left: -20%; right: -20%; bottom: -78%; height: 100%;
  border-radius: 50%;
  background:
    radial-gradient(ellipse 30% 18% at 40% 12%, rgba(255, 210, 120, .35), transparent 70%),
    radial-gradient(ellipse 22% 14% at 62% 10%, rgba(255, 200, 110, .25), transparent 70%),
    radial-gradient(ellipse at 50% 0%, #1b4fa8 0%, #0b2a6b 30%, #061638 60%);
  box-shadow:
    0 -6px 24px 4px rgba(92, 225, 255, .75),
    0 -20px 60px 18px rgba(47, 134, 255, .45),
    inset 0 10px 24px rgba(160, 230, 255, .6);
  pointer-events: none;
}

/* ---------- Hero ---------- */
.hero { padding: 72px 0 0; min-height: 560px; }
.hero .wrap { position: relative; z-index: 2; display: grid; grid-template-columns: 1.1fr 0.9fr; align-items: center; gap: 24px; }
.hero h1 { font-size: clamp(2.5rem, 6vw, 4.4rem); line-height: 1.02; margin: 0 0 20px; font-weight: 800; letter-spacing: -0.02em; text-shadow: 0 3px 0 rgba(0,0,0,.35); }
.hero h1 .accent { display: block; color: var(--gold); }
.hero .subtitle { font-size: clamp(1.1rem, 2.2vw, 1.4rem); color: var(--text-dim); margin: 0 0 28px; max-width: 30ch; font-weight: 600; }
.hero-copy { padding-bottom: 150px; }
.badge-soon {
  display: inline-flex; align-items: center; gap: 10px; padding: 12px 20px; border-radius: 14px;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.25); font-weight: 700;
}

/* Glossy block tower (original artwork) */
.tower-art { position: relative; height: 480px; }
.tower { position: absolute; bottom: -40px; left: 50%; width: 230px; transform: translateX(-50%) rotate(4deg); transform-origin: bottom center; display: flex; flex-direction: column; align-items: center; }
.blk {
  --c: var(--blue);
  width: 210px; height: 50px; border-radius: 12px; position: relative; margin-top: -2px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 70%, #fff) 0%, var(--c) 38%, color-mix(in srgb, var(--c) 78%, #000) 100%);
  box-shadow: inset 0 -6px 0 color-mix(in srgb, var(--c) 65%, #000), 0 4px 10px rgba(0,0,0,.35);
}
.blk::before {
  content: ""; position: absolute; left: 12px; right: 40%; top: 6px; height: 8px; border-radius: 6px;
  background: rgba(255,255,255,.55);
}
.blk.r { --c: var(--red); } .blk.y { --c: var(--yellow); } .blk.g { --c: var(--green); }
.blk.b { --c: var(--blue); } .blk.p { --c: var(--purple); }
.tower .blk:nth-child(1) { transform: translateX(-22px) rotate(-4deg); }
.tower .blk:nth-child(2) { transform: translateX(-12px) rotate(-2deg); }
.tower .blk:nth-child(3) { transform: translateX(-6px); }
.tower .blk:nth-child(4) { transform: translateX(6px); }
.tower .blk:nth-child(5) { transform: translateX(-4px); }
.tower .blk:nth-child(6) { transform: translateX(8px); }
.tower .blk:nth-child(7) { transform: translateX(2px); }
.falling { position: absolute; top: 20px; right: 4%; transform: rotate(-14deg); animation: drop 3.2s ease-in-out infinite; }
.falling::before {
  content: ""; position: absolute; left: 30px; right: 30px; bottom: 100%; height: 90px;
  background: linear-gradient(0deg, rgba(92,225,255,.45), transparent);
  clip-path: polygon(10% 100%, 90% 100%, 100% 0, 0 0);
}
.falling .blk { width: 120px; }
@keyframes drop { 0%, 100% { translate: 0 0; } 50% { translate: -6px 12px; } }
@media (prefers-reduced-motion: reduce) { .falling { animation: none; } }

@media (max-width: 860px) {
  .hero { padding-top: 48px; }
  .hero .wrap { grid-template-columns: 1fr; text-align: center; }
  .hero .subtitle { margin-left: auto; margin-right: auto; }
  .hero-copy { padding-bottom: 0; }
  .tower-art { height: 360px; }
  .tower { transform: translateX(-50%) rotate(4deg) scale(.8); }
}

/* ---------- Sections ---------- */
.section { padding: 72px 0; }
.section h2 { font-size: clamp(2rem, 4.5vw, 3rem); text-align: center; margin: 0 0 12px; font-weight: 800; letter-spacing: -0.01em; }
.section .lede { text-align: center; color: var(--text-dim); margin: 0 auto 40px; max-width: 46ch; font-size: 1.1rem; }
.purple { background: linear-gradient(180deg, var(--purple-800), var(--purple-700)); }

/* How to play */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; list-style: none; padding: 0; margin: 0; }
.step { text-align: center; }
.step-art { background: var(--card); border-radius: var(--radius); height: 170px; display: flex; align-items: flex-end; justify-content: center; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.step-art svg { width: 100%; height: 100%; }
.step h3 { font-size: 1.45rem; margin: 18px 0 6px; font-weight: 800; }
.step p { margin: 0; color: var(--text-dim); }
.more-rules { margin: 40px auto 0; max-width: 760px; background: rgba(0,0,0,.18); border-radius: var(--radius); padding: 20px 26px; }
.more-rules h3 { margin: 0 0 8px; font-size: 1.15rem; color: var(--gold); }
.more-rules ul { margin: 0; padding-left: 1.2em; color: var(--text-dim); }
.more-rules li { margin: 4px 0; }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; max-width: 380px; margin: 0 auto; } }

/* Game preview */
.preview { padding: 72px 0 0; }
.preview .wrap { position: relative; z-index: 2; display: grid; grid-template-columns: auto 1fr; gap: 56px; align-items: center; }
.phone {
  width: 280px; padding: 12px; border-radius: 48px; background: #0d0f1a;
  box-shadow: 0 0 0 2px #8b93a8, 0 0 0 5px #2a2e3b, 0 30px 60px rgba(0,0,0,.55);
  position: relative; margin-bottom: 56px;
}
.phone img { border-radius: 38px; width: 100%; height: auto; aspect-ratio: 603 / 1311; }
.phone::before { content: ""; position: absolute; top: 22px; left: 50%; width: 82px; height: 24px; border-radius: 14px; background: #000; transform: translateX(-50%); z-index: 2; }
.preview h2 { text-align: left; font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1.05; margin: 0 0 10px; font-weight: 800; letter-spacing: -0.01em; }
.preview .tagline { font-size: clamp(1.4rem, 3vw, 2.1rem); color: var(--gold); font-weight: 800; margin: 0 0 18px; }
.preview p { color: var(--text-dim); font-size: 1.1rem; max-width: 40ch; }
.preview-copy { padding-bottom: 80px; }
.moon { position: absolute; top: 40px; right: 6%; width: 86px; height: 86px; border-radius: 50%; z-index: 1;
  background: radial-gradient(circle at 35% 35%, #f2f2f2, #b9bcc6 55%, #6f7484 100%);
  box-shadow: inset -10px -8px 18px rgba(0,0,0,.35), 0 0 30px rgba(255,255,255,.18); }
.moon::before, .moon::after { content: ""; position: absolute; border-radius: 50%; background: rgba(90,95,110,.35); }
.moon::before { width: 18px; height: 18px; top: 22px; left: 46px; }
.moon::after { width: 12px; height: 12px; top: 52px; left: 24px; }
.store-note { display: inline-block; margin-top: 8px; padding: 12px 20px; border-radius: 14px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.25); font-weight: 700; color: var(--text); }
@media (max-width: 760px) {
  .preview .wrap { grid-template-columns: 1fr; text-align: center; gap: 24px; }
  .preview h2 { text-align: center; }
  .preview p { margin-left: auto; margin-right: auto; }
  .preview-copy { padding-bottom: 0; order: -1; }
  .phone { width: 240px; margin: 0 auto 48px; }
  .moon { width: 56px; height: 56px; top: 20px; }
}

/* Contact */
.contact { text-align: center; }
.contact .email-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 14px; }
.email-link { font-size: clamp(1.25rem, 3.5vw, 1.9rem); font-weight: 800; color: var(--text); text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 2px; overflow-wrap: anywhere; }
.email-link:hover { color: var(--gold); }
.copy-btn { font: inherit; font-weight: 700; padding: 10px 18px; border-radius: 12px; border: 0; background: var(--gold); color: var(--navy-900); cursor: pointer; }
.copy-btn:hover { filter: brightness(1.08); }
.copy-status { min-height: 1.5em; margin: 10px 0 0; color: var(--gold); font-weight: 700; }
.contact .help { color: var(--text-dim); max-width: 52ch; margin: 22px auto 0; }

/* Footer */
.site-footer { background: var(--navy-900); padding: 28px 0 36px; border-top: 1px solid rgba(91,134,255,.18); }
.site-footer ul { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 48px; list-style: none; margin: 0; padding: 0; }
.site-footer a { color: var(--text); text-decoration: none; font-weight: 700; }
.site-footer a:hover { color: var(--gold); text-decoration: underline; }
.site-footer .small { text-align: center; color: rgba(255,255,255,.55); font-size: .9rem; margin: 18px 0 0; }

/* ---------- Policy pages ---------- */
.doc { max-width: 760px; margin: 0 auto; padding: 48px 20px 72px; }
.doc h1 { font-size: clamp(2rem, 5vw, 2.8rem); line-height: 1.1; margin: 0 0 8px; }
.doc .meta { color: var(--text-dim); margin: 0 0 28px; }
.doc h2 { font-size: 1.4rem; margin: 36px 0 10px; color: var(--gold); }
.doc h3 { font-size: 1.1rem; margin: 22px 0 6px; }
.doc p, .doc li { color: rgba(255,255,255,.88); }
.doc table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: .95rem; }
.doc th, .doc td { text-align: left; vertical-align: top; padding: 10px; border-bottom: 1px solid rgba(255,255,255,.14); }
.doc th { color: var(--sky); }
.table-scroll { overflow-x: auto; }
.draft-banner { background: #5a2a00; border: 1px solid var(--gold); color: #ffe7b0; padding: 12px 16px; border-radius: 12px; margin: 0 0 24px; font-weight: 600; }
.doc-page { background: linear-gradient(180deg, #050a24 0%, #0b1440 100%); min-height: 100vh; }
