:root {
  --ink: #f4f1ea;
  --ink-dim: rgba(244, 241, 234, 0.72);
  --line: rgba(244, 241, 234, 0.22);
  --accent: #d8b48a;
  --accent-ink: #1a1410;
  --font-display: "Syne", sans-serif;
  --font-body: "Sora", sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  width: 100%;
  overflow-x: clip;
  background: #0a100e;
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

.boot {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-content: center;
  gap: 10px;
  background: #0a100e;
  transition: opacity 0.55s ease, visibility 0.55s ease;
}
.boot.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.boot-mark {
  margin: 0;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-size: 0.85rem;
  color: var(--accent);
}
.boot-msg {
  margin: 0;
  text-align: center;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(244, 241, 234, 0.5);
}

.world {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
}

#stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  touch-action: none;
  cursor: grab;
  opacity: 0;
  transition: opacity 0.55s ease;
}
.world.is-ready #stage { opacity: 1; }
#stage.is-dragging { cursor: grabbing; }

.veil {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(55% 45% at 50% 42%, rgba(110, 200, 212, 0.08), transparent 55%),
    radial-gradient(70% 55% at 50% 38%, rgba(216, 180, 138, 0.1), transparent 62%),
    linear-gradient(180deg, rgba(5, 8, 10, 0.5) 0%, rgba(5, 8, 10, 0.05) 36%, rgba(5, 8, 10, 0.12) 62%, rgba(5, 8, 10, 0.78) 100%);
}

.scanlines {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.025;
  background: repeating-linear-gradient(
    to bottom,
    rgba(244, 241, 234, 0.35) 0,
    rgba(244, 241, 234, 0.35) 1px,
    transparent 1px,
    transparent 4px
  );
  mix-blend-mode: soft-light;
}

.grain {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.07;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 6;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: max(16px, env(safe-area-inset-top)) 16px 0;
}

.mark {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.74rem;
  flex: 0 1 auto;
  min-width: 0;
}

.ghost {
  flex: 0 0 auto;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  color: var(--ink-dim);
  transition: color 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}
.ghost:hover { color: var(--ink); border-color: rgba(244, 241, 234, 0.45); }

.intro {
  position: absolute;
  top: max(68px, calc(env(safe-area-inset-top) + 52px));
  left: 16px;
  right: 16px;
  z-index: 5;
  max-width: 420px;
  pointer-events: none;
  transition: opacity 0.45s ease, transform 0.45s ease;
}
.intro.is-dim {
  opacity: 0.22;
  transform: translateY(-6px);
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8fd0d8;
  overflow-wrap: anywhere;
}

.intro h1 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.08;
  font-size: clamp(1.7rem, 7vw, 3.1rem);
  overflow-wrap: break-word;
}

.lede {
  margin: 0;
  max-width: 34ch;
  color: var(--ink-dim);
  font-weight: 300;
  line-height: 1.5;
  font-size: 0.92rem;
  overflow-wrap: break-word;
}

.hint {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 5;
  margin: 0;
  text-align: center;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(244, 241, 234, 0.55);
  pointer-events: none;
  transition: opacity 0.35s ease;
}
.hint.is-hidden { opacity: 0; }

.dock {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 7;
  width: auto;
  max-width: 720px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 12px 14px;
  padding: 12px;
  border: 1px solid rgba(244, 241, 234, 0.16);
  border-radius: 20px;
  background: rgba(12, 18, 16, 0.82);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px);
  transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  max-height: min(52svh, 420px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.dock.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.dock-media {
  width: 84px;
  height: 108px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(8, 12, 11, 0.05), rgba(8, 12, 11, 0.35)),
    var(--dock-shot) center / cover no-repeat;
  grid-row: span 2;
}

.dock-copy { min-width: 0; overflow-wrap: break-word; }
.dock-place {
  margin: 2px 0 4px;
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.dock h2 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 4.5vw, 1.55rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.dock-tag {
  margin: 0 0 6px;
  font-size: 0.88rem;
  color: var(--ink);
}
.dock-blurb {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--ink-dim);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dock-actions {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.primary,
.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  text-align: center;
}
.primary {
  background: var(--accent);
  color: var(--accent-ink);
}
.primary:hover { transform: translateY(-1px); }
.secondary {
  border: 1px solid var(--line);
  color: var(--ink-dim);
}
.secondary:hover {
  color: var(--ink);
  border-color: rgba(244, 241, 234, 0.45);
}

.intro,
.top .mark,
.hint {
  opacity: 0;
  transform: translateY(14px);
}
.world.is-ready .intro,
.world.is-ready .top .mark,
.world.is-ready .hint {
  animation: rise 0.95s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.world.is-ready .top .mark { animation-delay: 0.08s; }
.world.is-ready .intro { animation-delay: 0.18s; }
.world.is-ready .hint { animation-delay: 0.55s; }

@keyframes rise {
  to { opacity: 1; transform: none; }
}

@media (max-width: 720px) {
  .intro {
    max-width: none;
    top: max(60px, calc(env(safe-area-inset-top) + 44px));
  }
  .intro.is-dim { opacity: 0; pointer-events: none; }
  .intro h1 { font-size: clamp(1.55rem, 7.5vw, 2.1rem); }
  .lede {
    max-width: none;
    font-size: 0.86rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .dock {
    grid-template-columns: 68px minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
    left: 10px;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    max-height: min(48svh, 340px);
  }
  .dock-media {
    width: 68px;
    height: 88px;
    grid-row: auto;
  }
  .dock-tag { display: none; }
  .dock-actions {
    grid-column: 1 / -1;
  }
  .dock-actions .primary,
  .dock-actions .secondary {
    flex: 1 1 calc(50% - 6px);
    min-width: 0;
    min-height: 44px;
    padding: 0 10px;
    font-size: 0.8rem;
  }
  .dock-blurb { -webkit-line-clamp: 2; }
  .hint { display: none; }
}

@media (max-width: 380px) {
  .dock-actions .primary,
  .dock-actions .secondary {
    flex: 1 1 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .world.is-ready .intro,
  .world.is-ready .top .mark,
  .world.is-ready .hint {
    animation: none;
    opacity: 1;
    transform: none;
  }
  .dock { transition: none; }
  .boot { transition: none; }
}
