html { scroll-behavior: smooth; }

/* ── Cinematic backdrop: pre-rendered fly-through behind a heavy frost ── */
.landing-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: var(--bg);
  /* Promotes this fixed, playing video to its own compositor layer — without
     it, Safari repaints the video against the page on every scroll frame,
     which is what makes scroll feel janky/rubber-bandy on iOS. */
  transform: translateZ(0);
}
/* The blur is baked into the video file, never applied as a CSS `filter`.
   Blurring a playing 24fps video costs a full-viewport gaussian every frame;
   measured on a software-rendered client while scrolling, `filter: blur(14px)`
   on this video ran at 14fps against 75fps for the pre-blurred file.

   Two things that look like fixes and are not:
     - `backdrop-filter` on an overlay — re-blurs whenever the backdrop changes,
       which for a video is every frame. Same cost or worse.
     - blurring a small layer and scaling it up — Chrome rasterises a filtered
       layer at its composited scale, so this measured no better (54 vs 53fps).

   Matching the look needs two things that are easy to get wrong:
     - `filter: blur()` is NOT a true gaussian. The Filter Effects spec defines
       it as three successive box blurs, so ffmpeg `boxblur=r:3` matches the
       browser more closely than `gblur` (scored against a real browser render:
       boxblur 0.0072, gblur 0.0081, single-pass boxblur=r:1 worst at 0.0100).
       Radius comes from the spec: d = floor(sigma * 3*sqrt(2*PI)/4 + 0.5).
     - blur() is measured in VIEWPORT pixels while a baked blur scales with the
       image, so the correct radius depends on window width — hence the two
       encodes in index.html. Getting this wrong is very visible: a file baked
       for a 1600px window is ~2x too blurred on a 3840px one.

   Saturation uses the exact SVG saturate() matrix via colorchannelmixer rather
   than ffmpeg's `eq`, which scales chroma in YUV and drifts from CSS. */
.landing-backdrop video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  /* Browsers default <video> (unlike <img>) to object-fit:contain, which
     letterboxes/pillarboxes a 16:9 source inside any non-16:9 viewport —
     the purple bars on ultrawide monitors and the tiny centered rectangle
     on phones. `cover` fills the box on every aspect ratio, cropping the
     overflow instead — the standard treatment for a full-bleed background
     video, and what the 1.05 overscan scale below was already assuming. */
  object-fit: cover;
  transform: scale(1.05);
}
/* No grain/sheen overlay here on purpose. A tiled feTurbulence texture shows
   its tile grid at HiDPI, and a low-alpha diagonal sheen bands into visible
   steps over a dark backdrop — both read as rectangular artefacts near the
   edges. The frost character comes from the encode instead. */
/* Smoked-violet glass over the fly-through — the old card tint, lightened
   for full-page use so the town still glows through. */
.landing-backdrop-veil {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 115% 90% at 50% 40%, rgba(38, 20, 56, 0.36) 45%, rgba(32, 14, 50, 0.64) 100%),
    rgba(40, 18, 58, 0.14);
}

.landing-page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(1.5rem, 7vh, 4rem) 1.5rem clamp(1rem, 3vh, 2rem);
  gap: 2.75rem;
}

.landing-hero {
  position: relative;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.seal-mark {
  width: 112px;
  height: 112px;
  margin-bottom: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: seal-in 0.5s var(--ease-out);
}
.seal-mark img {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.5));
}

@keyframes seal-in {
  from { opacity: 0; transform: scale(0.6) rotate(-25deg); }
  to   { opacity: 1; transform: none; }
}

/* ── Public beta sign: an old wooden plank hung by rope from the top-left
   corner of the page, independent of the centered hero content below. ── */
.beta-sign {
  /* Fluid width instead of a breakpoint jump: scales continuously from
     phones up through desktop, then holds at 172px so it doesn't keep
     growing on ultra-wide monitors. */
  position: fixed;
  top: 0;
  left: clamp(0.6rem, 4vw, 2.5rem);
  z-index: 5;
  width: clamp(124px, 6vw + 100px, 172px);
  pointer-events: none;
  transform-origin: top center;
  animation: beta-sign-sway 6s ease-in-out infinite;
  /* Keeps the rope/board clear of the notch or Dynamic Island — matches the
     viewport-fit=cover safe-area handling game.html already needs. */
  padding-top: env(safe-area-inset-top);
}
.beta-sign-rope {
  position: absolute;
  top: 0;
  width: 3px;
  height: clamp(42px, 4vw + 32px, 58px);
  background: repeating-linear-gradient(50deg, #9a7a4a 0 3px, #6b4e28 3px 6px);
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
}
.beta-sign-rope--l { left: 13%; transform: rotate(-3deg); }
.beta-sign-rope--r { left: 79%; transform: rotate(3deg); }

.beta-sign-board {
  position: relative;
  margin-top: clamp(38px, 4vw + 28px, 54px);
  /* Top and bottom padding are equal on purpose: "Public" and "Beta" are two
     equal-height lines, so symmetric padding is what makes each one land
     centered in its own half of the board relative to the seam at 50%. */
  padding: clamp(1.1rem, 1.5vw + 0.75rem, 1.5rem) clamp(0.75rem, 1vw + 0.5rem, 1rem);
  text-align: center;
  transform: rotate(-2.5deg);
  border-radius: 3px;
  /* Fractal-noise turbulence (grayscale, elongated on one axis) blended
     over the base gradient reads as real grain instead of a flat/mechanical
     repeating pattern; a soft radial patch fakes a knot for imperfection. */
  background-image:
    url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMjAiIGhlaWdodD0iMjIwIj4KICA8ZmlsdGVyIGlkPSJuIj4KICAgIDxmZVR1cmJ1bGVuY2UgdHlwZT0iZnJhY3RhbE5vaXNlIiBiYXNlRnJlcXVlbmN5PSIwLjAwOSAwLjExIiBudW1PY3RhdmVzPSI1IiBzZWVkPSIxMSIgc3RpdGNoVGlsZXM9InN0aXRjaCIgcmVzdWx0PSJ0Ii8+CiAgICA8ZmVDb2xvck1hdHJpeCBpbj0idCIgdHlwZT0ic2F0dXJhdGUiIHZhbHVlcz0iMCIvPgogIDwvZmlsdGVyPgogIDxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbHRlcj0idXJsKCNuKSIvPgo8L3N2Zz4K"),
    radial-gradient(ellipse 38% 30% at 72% 68%, rgba(28, 16, 6, 0.45), transparent 72%),
    linear-gradient(155deg, #8f6a3e 0%, #6b4726 55%, #4a2f18 100%);
  background-blend-mode: overlay, multiply, normal;
  /* The noise layer is stretched to fill the board rather than tiled at a
     fixed size — tiling a rasterized feTurbulence SVG left a hairline seam
     at the repeat boundary (a browser rasterization artifact, not a design
     choice) that shifted with zoom/DPR. One untiled copy has no boundary to
     seam at, and since it's noise rather than a directional pattern, a
     stretched copy still reads as grain. */
  background-size: 100% 100%, auto, auto;
  background-repeat: no-repeat;
  border: 3px solid #3a2414;
  box-shadow:
    0 16px 32px -10px rgba(0, 0, 0, 0.6),
    inset 0 0 0 2px rgba(0, 0, 0, 0.2),
    inset 0 2px 6px rgba(255, 220, 170, 0.08);
}
.beta-sign-board::after {
  /* A single board-joint seam rather than a perfectly repeating stack of
     them — one plank, not a printed pattern. */
  content: '';
  position: absolute;
  left: 5px;
  right: 5px;
  top: 48.3%;
  height: 2px;
  background: rgba(0, 0, 0, 0.28);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05);
}
.beta-sign-nail {
  position: absolute;
  top: 10px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #cfa96a, #4a3216 70%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
.beta-sign-nail--l { left: 12px; }
.beta-sign-nail--r { right: 12px; }
.beta-sign-text {
  display: block;
  position: relative;
  z-index: 1;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(0.85rem, 1vw + 0.6rem, 1.15rem);
  line-height: 1.35;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #f7ecc8;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.8), 0 2px 3px rgba(0, 0, 0, 0.75);
}
@keyframes beta-sign-sway {
  0%, 100% { transform: rotate(-1.2deg); }
  50%      { transform: rotate(1.2deg); }
}
@media (prefers-reduced-motion: reduce) {
  .beta-sign { animation: none; }
}

.landing-hero h1 {
  font-size: clamp(2.2rem, 3.6vw, 3.2rem);
  color: var(--gold);
  letter-spacing: 0.06em;
  text-shadow: 0 0 60px rgba(200,164,94,0.35);
}
.landing-hero p {
  color: var(--text);
  font-size: 1.05rem;
  margin-top: 0.6rem;
  text-shadow: 0 1px 14px rgba(22, 14, 44, 0.75);
}
/* ── Asymmetric spread: primary role card + secondary create/load rail ── */
.landing-spread {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 1.5rem;
  width: 100%;
  max-width: 900px;
  align-items: start;
}
.landing-primary-col,
.landing-secondary {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
@media (max-width: 760px) {
  .landing-spread { grid-template-columns: 1fr; }
}

/* ── Scroll cue at the foot of the hero screen ── */
.scroll-cue {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-pill);
  color: var(--gold);
  font-size: 1rem;
  animation: scroll-cue-bob 2.2s ease-in-out infinite;
  transition: border-color 0.15s, background 0.15s;
}
.scroll-cue:hover {
  border-color: var(--gold-dim);
  background: rgba(200,164,94,0.08);
  text-decoration: none;
}
@keyframes scroll-cue-bob {
  0%, 100% { transform: translateY(0); opacity: 0.75; }
  50%      { transform: translateY(6px); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .scroll-cue { animation: none; }
}

.landing-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: var(--shadow-1);
}
.landing-card h2 {
  font-size: 1rem;
  color: var(--gold);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.25rem;
}

.landing-card--primary {
  padding: 2.25rem 2rem;
  border-color: var(--gold-dim);
  box-shadow: var(--shadow-2);
}
.landing-card--compact {
  padding: 1.5rem 1.75rem;
}
.landing-card--recover {
  padding: 1.1rem 1.75rem;
  gap: 0.6rem;
}
.landing-card--recover h2 {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}
.landing-recover-row {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
}
.landing-recover-row .form-group {
  flex: 1;
  min-width: 0;
}
@media (max-width: 480px) {
  .landing-recover-row { flex-direction: column; align-items: stretch; }
}

/* ── Pre-session setup modal (overlay/modal shell now lives in ui.css, shared
   with the contact modal on other pages) ── */
.setup-section {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.setup-add-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.setup-add-row input[type="text"],
.setup-add-row input[type="number"] {
  flex: 1;
  width: auto;
}

input.setup-narrow {
  flex: 0 0 80px;
  width: 80px;
}

.setup-color {
  flex-shrink: 0;
  width: 38px;
  height: 34px;
  padding: 2px 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
}

.setup-tag-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.setup-tag {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.82rem;
}

.setup-tag-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.setup-tag-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.setup-tag-name {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.setup-tag-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.setup-tag-remove {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  padding: 0.15rem 0.35rem;
  font-size: 0.78rem;
  opacity: 0.65;
  line-height: 1;
}
.setup-tag-remove:hover { opacity: 1; background: none; }

.vtt-upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  text-align: center;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  height: 96px;
  padding: 0 1rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.vtt-upload-icon {
  font-size: 1.3rem;
  color: var(--gold-dim);
  transition: transform 0.2s var(--ease-out), color 0.15s;
}
.vtt-upload-label:hover,
.vtt-upload-label.drag-over {
  border-color: var(--gold);
  background: rgba(200,164,94,0.06);
  color: var(--text);
}
.vtt-upload-label:hover .vtt-upload-icon,
.vtt-upload-label.drag-over .vtt-upload-icon {
  color: var(--gold);
  transform: translateY(2px);
}

.vtt-file-selected {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  border: 1px solid var(--border);
  border-left: 2px solid var(--success);
  border-radius: var(--radius);
  background: var(--bg);
  height: 96px;
  padding: 0 0.75rem;
}
.vtt-file-check {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--success) 18%, transparent);
  color: var(--success);
  font-size: 0.8rem;
  font-weight: 700;
}
.vtt-file-info { flex: 1; min-width: 0; }
.vtt-file-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vtt-file-size {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

/* ── Marketing section ───────────────────────────────────────────────────────
   Its own self-contained design system — a local token set on
   .landing-marketing, kept separate from the shared --gold/--bg/etc. used by
   the dark hero above and by game.html — so this can be restyled without
   touching anything else. Uses the site's own dark ink/gold palette. The
   cinematic backdrop is `position:fixed`; this section's top gradient fades
   it out to solid ink as the page scrolls. html/body run at a 14px root
   (css/main.css, shared with the dense in-game UI) so every rem value below
   is deliberately oversized to land at real pixel targets — e.g. 2.9rem ≈
   40px. */
.landing-marketing {
  position: relative;
  z-index: 1;
  overflow-x: hidden;

  --mkt-bg:        #0d0b12;
  --mkt-bg-alt:    #1c1723;
  --mkt-border:    #3d3550;
  --mkt-text:      #e7e7f2;
  --mkt-muted:     #8585ad;
  --mkt-accent:    #c8a45e;
  --mkt-accent-soft: rgba(200, 164, 94, 0.12);
  --mkt-radius-lg: 28px;
  --mkt-radius-md: 18px;
  --mkt-shadow:    0 24px 48px -16px rgba(0, 0, 0, 0.5), 0 8px 20px -10px rgba(0, 0, 0, 0.35);

  /* 8px spacing scale */
  --mkt-sp-1: 0.5rem;   /* 8  */
  --mkt-sp-2: 1rem;     /* 16 */
  --mkt-sp-3: 1.5rem;   /* 24 */
  --mkt-sp-4: 2rem;     /* 32 */
  --mkt-sp-6: 3rem;     /* 48 */
  --mkt-sp-8: 4rem;     /* 64 */
  --mkt-sp-10: 5.7rem;  /* ~80 */
  --mkt-sp-15: 8.6rem;  /* ~120 */

  background: linear-gradient(to bottom, transparent 0, var(--mkt-bg) 560px);
}

.mkt-container {
  max-width: 1360px;
  margin: 0 auto;
  padding: var(--mkt-sp-10) clamp(1.25rem, 5vw, var(--mkt-sp-8)) 0;
  display: flex;
  flex-direction: column;
  gap: var(--mkt-sp-10);
}

/* Each row is one big rounded "room": subtle tinted card, light border,
   generous internal padding — not a plain flat section. */
.mkt-row-card {
  background: var(--mkt-bg-alt);
  border: 1px solid var(--mkt-border);
  border-radius: var(--mkt-radius-lg);
  padding: clamp(1.75rem, 4vw, var(--mkt-sp-8));
}

.mkt-row-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: var(--mkt-sp-8);
  align-items: center;
}
.mkt-row--flip .mkt-row-grid { grid-template-columns: 1.3fr 1fr; }
.mkt-row--flip .mkt-row-text { order: 2; }
.mkt-row--flip .mkt-row-visual { order: 1; }

.mkt-row-text h2 {
  font-family: var(--font-body);
  font-size: 2.7rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--mkt-text);
  margin-bottom: var(--mkt-sp-3);
  text-wrap: balance;
}
.mkt-row-text p {
  font-size: 1.25rem;
  color: var(--mkt-muted);
  line-height: 1.6;
  max-width: 46ch;
}

.mkt-points {
  list-style: none;
  margin: var(--mkt-sp-4) 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--mkt-sp-2) var(--mkt-sp-3);
}
.mkt-points li {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--mkt-text);
  padding-left: 1.6rem;
  position: relative;
}
.mkt-points li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.5em;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--mkt-accent);
}

/* Visual: rounded, shadowed, on a soft gradient glow, gentle hover lift */
.mkt-row-visual {
  position: relative;
  border-radius: var(--mkt-radius-md);
}
.mkt-visual-glow {
  position: absolute;
  inset: -16px;
  background: radial-gradient(closest-side, var(--mkt-accent-soft), transparent 55%);
  z-index: 0;
}
.mkt-visual-img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--mkt-radius-md);
  box-shadow: var(--mkt-shadow);
  transition: transform 280ms cubic-bezier(0.16, 1, 0.3, 1);
}
.mkt-row-visual:hover .mkt-visual-img { transform: translateY(-6px) scale(1.015); }

/* Scroll-in reveal — respects reduced motion, degrades to always-visible
   if JS never runs (see js/landing.js) */
[data-mkt-animate] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 600ms cubic-bezier(0.16, 1, 0.3, 1), transform 600ms cubic-bezier(0.16, 1, 0.3, 1);
}
[data-mkt-animate].is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  [data-mkt-animate] { opacity: 1; transform: none; transition: none; }
}

@media (max-width: 860px) {
  .mkt-row-grid, .mkt-row--flip .mkt-row-grid { grid-template-columns: 1fr; gap: var(--mkt-sp-4); }
  .mkt-row--flip .mkt-row-text, .mkt-row--flip .mkt-row-visual { order: 0; }
  .mkt-row-visual { order: -1; }
  .mkt-row-text h2 { font-size: 2rem; }
  .mkt-row-text p { font-size: 1.1rem; max-width: none; }
  .mkt-points { grid-template-columns: 1fr; }
  .mkt-container { gap: var(--mkt-sp-8); padding-top: var(--mkt-sp-8); }
}

/* Closing CTA — bookends the crossed-swords seal from the hero, on the same
   light ground as the rest of this section. */
.marketing-footer {
  width: 100%;
  max-width: 700px;
  margin: 0 auto;
  padding: var(--mkt-sp-15, 8.6rem) clamp(1.25rem, 5vw, var(--mkt-sp-8)) var(--mkt-sp-10);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--mkt-sp-3);
  text-align: center;
}
.marketing-footer-seal { width: 44px; height: 44px; opacity: 0.8; }
.marketing-footer h2 {
  font-family: var(--font-body);
  font-size: 2rem;
  font-weight: 800;
  color: var(--mkt-text, #e7e7f2);
  margin: 0 0 var(--mkt-sp-2, 1rem);
}
.mkt-cta-btn {
  display: inline-flex;
  width: auto;
  background: var(--mkt-accent, #c8a45e);
  color: #1a1408;
  border: none;
  border-radius: 999px;
  padding: 0.95rem 2.4rem;
  font-size: 1.05rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 12px 28px -10px rgba(200, 164, 94, 0.4);
  transition: transform 220ms ease, box-shadow 220ms ease;
}
.mkt-cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px -10px rgba(200, 164, 94, 0.45);
  text-decoration: none;
}
.mkt-cta-note {
  font-size: 0.95rem;
  color: var(--mkt-muted);
  margin-top: var(--mkt-sp-1);
}
