:root {
  --bg: #050508;
  --ink: rgba(255, 255, 255, 0.82);
}

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

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "SF Pro Display", "SF Pro Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  overflow: hidden;
  min-height: 100dvh;
}

body.is-open { overflow: auto; }
body.is-open .stage {
  justify-content: flex-start;
  padding: 4.4rem 1.25rem 3rem;
}


.nav {
  position: fixed;
  top: max(0.9rem, calc(env(safe-area-inset-top) + 0.55rem));
  left: max(0.9rem, calc(env(safe-area-inset-left) + 0.55rem));
  z-index: 30;
}

.nav-btn {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: 2.45rem;
  height: 2.45rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 0.58rem 0.52rem;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 0.72rem;
  background: transparent;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 10px 28px rgba(0, 0, 0, 0.28);
  cursor: pointer;
}

.nav-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(22px) saturate(1.55);
  -webkit-backdrop-filter: blur(22px) saturate(1.55);
  pointer-events: none;
}

.nav-btn span {
  display: block;
  width: 100%;
  height: 1.5px;
  flex: 0 0 1.5px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.82);
  transform-origin: center;
  transition: transform 0.22s ease, opacity 0.18s ease;
}

.nav.is-open .nav-btn span:nth-of-type(1) { transform: translateY(6.5px) rotate(45deg); }
.nav.is-open .nav-btn span:nth-of-type(2) {
  opacity: 0;
  visibility: hidden;
  transform: scaleX(0);
}
.nav.is-open .nav-btn span:nth-of-type(3) { transform: translateY(-6.5px) rotate(-45deg); }

.nav-list {
  position: relative;
  isolation: isolate;
  margin: 0.45rem 0 0;
  padding: 0.32rem;
  list-style: none;
  min-width: 10.6rem;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 0.85rem;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 14px 32px rgba(0, 0, 0, 0.34);
}

.nav-list::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: rgba(8, 8, 14, 0.72);
  backdrop-filter: blur(22px) saturate(1.55);
  -webkit-backdrop-filter: blur(22px) saturate(1.55);
  pointer-events: none;
}

.nav-list a {
  display: block;
  padding: 0.55rem 0.72rem;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  border-radius: 0.58rem;
  font-size: 0.92rem;
  letter-spacing: 0.01em;
}

.nav-list a:hover {
  color: rgba(255, 255, 255, 0.96);
  background: rgba(255, 255, 255, 0.08);
}

.nav-btn:focus-visible,
.nav-list a:focus-visible {
  outline: 2px solid rgba(190, 220, 255, 0.7);
  outline-offset: 2px;
}

.bloom {
  position: fixed;
  inset: -22%;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(44% 36% at 24% 30%, rgba(130, 180, 255, 0.22), transparent 70%),
    radial-gradient(38% 32% at 76% 22%, rgba(255, 105, 180, 0.14), transparent 72%),
    radial-gradient(34% 30% at 70% 74%, rgba(255, 208, 120, 0.11), transparent 70%),
    radial-gradient(30% 28% at 18% 78%, rgba(165, 125, 255, 0.12), transparent 68%),
    radial-gradient(52% 42% at 50% 52%, rgba(80, 110, 190, 0.08), transparent 74%);
  filter: blur(40px);
}

.stars {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  z-index: 1;
}

.stage {
  position: relative;
  z-index: 2;
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.gate {
  position: relative;
  width: min(22rem, 100%);
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.gate[hidden],
.panel[hidden] { display: none; }

.gate input {
  width: 100%;
  padding: 0.72rem 0.95rem;
  font: inherit;
  font-size: 1rem;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  outline: none;
  backdrop-filter: blur(22px) saturate(1.55);
  -webkit-backdrop-filter: blur(22px) saturate(1.55);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 10px 28px rgba(0, 0, 0, 0.28);
}

.gate input::placeholder {
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.38);
}

.gate input:focus {
  border-color: rgba(190, 220, 255, 0.55);
}

.gate.bad input {
  border-color: rgba(255, 120, 120, 0.55);
  animation: shake 0.38s ease;
}

@keyframes shake {
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

.hint {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.55rem);
  margin: 0;
  text-align: center;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.38);
}

.panel {
  width: min(34rem, 100%);
}


.shelf {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.shelf h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 560;
  letter-spacing: -0.03em;
  color: rgba(255, 255, 255, 0.92);
}

.lede {
  margin: 0 0 1.6rem;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.48);
}

.card {
  display: block;
  padding: 1rem 1.15rem 1.05rem;
  color: inherit;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  backdrop-filter: blur(22px) saturate(1.55);
  -webkit-backdrop-filter: blur(22px) saturate(1.55);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 10px 28px rgba(0, 0, 0, 0.22);
}

.card:hover {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.22);
}

.card strong {
  display: block;
  margin-bottom: 0.28rem;
  font-size: 1.05rem;
  font-weight: 560;
  color: rgba(255, 255, 255, 0.92);
}

.card span {
  display: block;
  font-size: 0.9rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.5);
}

@media (prefers-reduced-motion: reduce) {
  .gate.bad input { animation: none; }
}

.hole {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  z-index: 4;
}

body.is-eating .gate input {
  pointer-events: none;
}

body.is-eating .bloom,
body.is-eating .gate {
  will-change: transform, filter, opacity;
}

@media (prefers-reduced-motion: reduce) {
  body.is-eating .bloom,
  body.is-eating .gate { transform: none !important; }
}
