:root { --ink: #f1ebdd; --gold: #f2d9a0; }
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #02040a; color: var(--ink);
  font-family: 'Jost', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

/* the dome */
#sky { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; outline: none; }
#sky.dragging { cursor: grabbing; }
#sky.hot { cursor: pointer; }

/* the name */
#brand {
  position: fixed; left: 50%; top: 22px; z-index: 5;
  transform: translateX(-50%) scale(1);
  text-align: center; pointer-events: none;
  text-shadow: 0 0 28px rgba(0, 0, 0, .7);
  transition: transform 1.8s cubic-bezier(.22, .7, .25, 1);
  will-change: transform;
  backface-visibility: hidden;
  -webkit-font-smoothing: antialiased;
}
#brand h1 {
  margin: 0; font-family: 'Great Vibes', 'Snell Roundhand', 'Apple Chancery', cursive;
  font-weight: 400; font-size: clamp(40px, 6vw, 62px); line-height: 1; letter-spacing: .01em;
}
#brand p {
  margin: 8px 0 0; font-weight: 300; font-size: 13px; letter-spacing: .55em; text-indent: .55em;
  text-transform: lowercase; opacity: .78;
}
body.intro #brand {
  top: 22px;
  transform: translateX(-50%) translateY(calc(50vh - 22px)) scale(1.75);
}

/* the way in */
#intro {
  position: fixed; inset: 0; z-index: 8; display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 13vh;
  background: radial-gradient(ellipse at 50% 45%, rgba(2, 4, 10, .25), rgba(2, 4, 10, .78));
  transition: opacity 2s ease;
  isolation: isolate;
}
body:not(.intro) #intro { opacity: 0; pointer-events: none; }
.intro-glow {
  position: absolute; left: 50%; top: 46%; width: 130px; height: 130px;
  transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(circle, rgba(242, 217, 160, .16), rgba(242, 217, 160, .03) 38%, transparent 72%);
  filter: blur(3px); pointer-events: none;
}
.intro-orbit {
  position: absolute; left: 50%; top: 46%; width: 190px; height: 190px;
  transform: translate(-50%, -50%) rotate(-18deg); border: 1px solid rgba(242, 217, 160, .12);
  border-left-color: transparent; border-right-color: transparent; border-radius: 50%;
  pointer-events: none;
}
.intro-orbit::after {
  content: ""; position: absolute; left: 50%; top: -3px; width: 5px; height: 5px;
  border-radius: 50%; background: #ffe7ae; box-shadow: 0 0 16px rgba(255, 231, 174, .8);
  transform: translateX(-50%);
}
.intro-constellation {
  position: absolute; left: 50%; top: 46%; width: min(390px, 78vw); height: 238px;
  transform: translate(-50%, -50%); overflow: visible; pointer-events: none;
}
.constellation-lines path {
  fill: none; stroke: rgba(255, 232, 184, .34); stroke-width: 1;
  stroke-dasharray: 520; stroke-dashoffset: 520;
}
.constellation-stars circle {
  fill: #fff3c9; opacity: 0;
  filter: drop-shadow(0 0 5px rgba(255, 230, 170, .9));
}
#brand h1 .title-char { display: inline-block; will-change: transform, opacity; }
#brand h1 .title-space { display: inline-block; width: .28em; }
#enter {
  font: inherit; font-weight: 300; font-size: 12px; letter-spacing: .4em; text-indent: .4em; text-transform: uppercase;
  color: var(--ink); background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .32);
  border-radius: 999px; padding: 15px 30px; cursor: pointer; min-height: 48px;
  animation: breathe 3.4s ease-in-out infinite;
  transition: background .4s, border-color .4s;
}
#enter:hover { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .6); }
@keyframes breathe { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }

/* tiny hint */
#hint {
  position: fixed; left: 0; right: 0; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 4;
  margin: 0; text-align: center; font-size: 11px; letter-spacing: .24em; text-transform: lowercase;
  opacity: 0; transition: opacity 1.6s ease; pointer-events: none;
}
#hint.on { opacity: .5; }

/* the password gate over the planets */
#gate {
  position: fixed; inset: 0; z-index: 12; display: flex; align-items: center; justify-content: center;
  padding: 24px; overflow: auto;
  background: rgba(2, 3, 8, .76); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  opacity: 0; transition: opacity .6s ease;
}
#gate.show { opacity: 1; }
#gate[hidden] { display: none; }
#gate-card {
  position: relative; overflow: hidden; width: min(460px, 100%); text-align: center; padding: 26px 28px 24px; border-radius: 26px;
  background: linear-gradient(165deg, rgba(16, 20, 38, .95), rgba(5, 7, 16, .95));
  border: 1px solid rgba(242, 217, 160, .28);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .03) inset, 0 24px 90px rgba(0, 0, 0, .7), 0 0 60px rgba(242, 217, 160, .08);
}
#gate-card::before {
  content: ""; position: absolute; inset: -60% -20% auto; height: 70%;
  background: radial-gradient(ellipse at 50% 0, rgba(242, 217, 160, .14), transparent 70%); pointer-events: none;
}
.gate-seal { position: relative; width: 88px; height: 88px; margin: 0 auto 6px; filter: drop-shadow(0 0 14px rgba(242, 217, 160, .35)); }
.gate-seal svg { width: 100%; height: 100%; overflow: visible; }
.seal-ring { fill: none; stroke: rgba(242, 217, 160, .34); stroke-width: 1; stroke-dasharray: 8 7; transform-origin: 60px 60px; animation: sealSpin 26s linear infinite; }
.seal-ring-2 { stroke: rgba(242, 217, 160, .18); stroke-dasharray: 3 9; animation-duration: 17s; animation-direction: reverse; }
.seal-path { fill: none; stroke: rgba(242, 217, 160, .5); stroke-width: 1; }
.seal-dot { fill: #ffe7ae; filter: drop-shadow(0 0 8px #ffe7ae); }
@keyframes sealSpin { to { transform: rotate(360deg); } }
#gate-kind { margin: 0 0 8px; font-size: 10px; letter-spacing: .34em; text-transform: uppercase; opacity: .7; color: var(--gold); }
#gate-title { margin: 0 0 10px; font-family: 'Great Vibes', cursive; font-weight: 400; font-size: clamp(28px, 5vw, 38px); }
#gate-copy { margin: 0 0 18px; font-family: 'Cormorant Garamond', Georgia, serif; font-size: 17px; line-height: 1.45; opacity: .9; }
.gate-field { display: block; text-align: left; margin-bottom: 10px; }
.gate-field > span { display: block; margin: 0 0 5px 4px; font-size: 10px; letter-spacing: .22em; text-transform: uppercase; color: rgba(242, 217, 160, .72); }
#gate-form input {
  width: 100%; height: 44px; padding: 0 14px; border-radius: 14px; font: inherit; font-size: 15px;
  color: var(--ink); background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .16);
  transition: border-color .3s, box-shadow .3s, background .3s;
}
#gate-form input:focus { outline: none; border-color: rgba(242, 217, 160, .6); background: rgba(242, 217, 160, .07); box-shadow: 0 0 0 3px rgba(242, 217, 160, .1); }
#gate-form input::placeholder { color: rgba(241, 235, 221, .32); }
#gate-form button {
  width: 100%; height: 46px; margin-top: 6px; border-radius: 14px;
  border: 1px solid rgba(242, 217, 160, .5);
  background: linear-gradient(100deg, rgba(242, 217, 160, .14), rgba(242, 217, 160, .28), rgba(242, 217, 160, .14));
  color: var(--gold); font: inherit; font-size: 13px; letter-spacing: .18em; text-transform: lowercase; cursor: pointer;
  transition: transform .3s, box-shadow .3s;
}
#gate-form button:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(242, 217, 160, .16); }
#gate-wrong { min-height: 18px; margin: 12px 0 0; font-size: 12px; letter-spacing: .08em; color: #ffb4a8; opacity: 0; transition: opacity .3s ease; }
#gate-wrong.show { opacity: .9; }
#gate-card.shake { animation: shake .45s ease; }
#gate-card input.miss { animation: fieldMiss .5s ease; border-color: #ff9c8c; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@keyframes fieldMiss { 25%, 75% { transform: translateX(-4px); } 50% { transform: translateX(4px); } }

/* an opened planet */
#hall {
  position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); z-index: 10;
  width: min(620px, calc(100vw - 28px)); max-height: 60vh; overflow: auto;
  padding: 32px 32px 26px; border-radius: 22px;
  background: rgba(5, 8, 18, .74); border: 1px solid rgba(255, 255, 255, .11);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  box-shadow: 0 20px 70px rgba(0, 0, 0, .55);
  opacity: 0; transform: translate(-50%, 24px);
  transition: opacity .8s ease, transform .8s cubic-bezier(.2, .7, .2, 1);
}
#hall[hidden] { display: none; }
#hall.show { opacity: 1; transform: translate(-50%, 0); }
#hall-close {
  position: absolute; top: 8px; right: 8px; width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: transparent; color: var(--ink); font-size: 28px; line-height: 1; cursor: pointer; opacity: .6;
}
#hall-close:hover { opacity: 1; background: rgba(255, 255, 255, .08); }
#hall-kind { margin: 0 0 6px; font-size: 11px; letter-spacing: .34em; text-transform: uppercase; opacity: .7; color: var(--gold); }
#hall-title {
  margin: 0 0 18px; font-family: 'Great Vibes', 'Snell Roundhand', cursive; font-weight: 400;
  font-size: clamp(34px, 6vw, 46px); line-height: 1.1;
}
#hall-body { font-family: 'Cormorant Garamond', Georgia, serif; font-size: clamp(20px, 3.4vw, 24px); line-height: 1.55; }
#hall-body p { margin: 0 0 .85em; white-space: pre-line; }
.line { opacity: 0; transform: translateY(10px); animation: lineIn 1.4s ease forwards; }
@keyframes lineIn { to { opacity: 1; transform: none; } }
#hall-body figure { margin: 1em 0; }
#hall-body img, #hall-body video { display: block; max-width: 100%; max-height: 34vh; border-radius: 12px; }
#hall-body audio { width: 100%; margin-top: .4em; }
#hall-fact {
  margin: 14px 0 0; padding: 12px 14px; border-radius: 12px; background: rgba(255, 255, 255, .045);
  border-inline-start: 2px solid rgba(242, 217, 160, .5);
  font-size: 13px; line-height: 1.5; opacity: 0; letter-spacing: .01em;
}
#hall-fact.show { opacity: .82; animation: lineIn .9s ease forwards; }
#hall-fact:empty { display: none; }
#hall-date { margin: 10px 0 0; font-size: 12px; letter-spacing: .24em; opacity: .55; text-transform: lowercase; }

/* gallery (Shared Sky) */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-top: 6px; }
.gallery img { width: 100%; height: 110px; object-fit: cover; border-radius: 10px; }
.gallery .add {
  display: flex; align-items: center; justify-content: center; height: 110px; border-radius: 10px;
  border: 1px dashed rgba(255, 255, 255, .25); font-size: 28px; opacity: .5;
}

/* the Tonight box that writes itself */
#tonight {
  position: fixed; right: max(18px, env(safe-area-inset-right)); top: max(18px, env(safe-area-inset-top)); z-index: 9;
  width: min(300px, calc(100vw - 36px)); border-radius: 18px;
  background: rgba(6, 9, 20, .68); border: 1px solid rgba(255, 255, 255, .1);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  padding: 16px 16px 12px; box-shadow: 0 16px 50px rgba(0, 0, 0, .45);
  opacity: 0; transform: translateY(-10px) scale(.96); transition: opacity .5s ease, transform .5s cubic-bezier(.2, .7, .2, 1);
}
#tonight.show { opacity: 1; transform: none; }
#tonight[hidden] { display: none; }
#tonight-close { position: absolute; top: 2px; right: 6px; width: 32px; height: 32px; border: 0; background: transparent; color: var(--ink); font-size: 20px; opacity: .5; cursor: pointer; }
#tonight-kind { margin: 0 0 8px; font-size: 10px; letter-spacing: .3em; text-transform: uppercase; color: var(--gold); opacity: .75; }
#tonight-body { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 15px; line-height: 1.5; min-height: 24px; }
#tonight-body .t-line { opacity: 0; animation: lineIn 1s ease forwards; margin: 0 0 .5em; }
#tonight-body .t-reply { color: var(--gold); }
#tonight-form { display: flex; gap: 6px; margin-top: 10px; }
#tonight-input {
  flex: 1; min-width: 0; height: 36px; padding: 0 12px; border-radius: 18px; font: inherit; font-size: 13px;
  color: var(--ink); background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .18);
}
#tonight-form button {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid rgba(242, 217, 160, .4);
  background: rgba(242, 217, 160, .12); color: var(--gold); cursor: pointer; font-size: 14px;
}

#hall-close:focus-visible, #enter:focus-visible, #gate-input:focus-visible, #gate-form button:focus-visible,
#tonight-input:focus-visible, #tonight-form button:focus-visible, #tonight-close:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 3px;
}

@media (max-width: 520px) {
  #tonight { left: max(18px, env(safe-area-inset-left)); right: max(18px, env(safe-area-inset-right)); width: auto; top: auto; bottom: max(18px, env(safe-area-inset-bottom)); }
}

/* the warp when "touch the sky" opens */
#warp { position: fixed; inset: 0; z-index: 9; pointer-events: none; overflow: hidden; }
.warp-ring {
  position: absolute; left: 50%; top: 50%; width: 20vmin; height: 20vmin; border-radius: 50%;
  border: 1px solid rgba(242, 217, 160, .5); transform: translate(-50%, -50%) scale(.1); opacity: 0;
  box-shadow: 0 0 40px rgba(242, 217, 160, .15), inset 0 0 40px rgba(242, 217, 160, .08);
}
.warp-flash {
  position: absolute; inset: 0; opacity: 0; transform: scale(.2);
  background: radial-gradient(circle at 50% 50%, rgba(255, 245, 220, .9), rgba(242, 217, 160, .18) 32%, transparent 68%);
}
body.warping #sky { filter: blur(1px) brightness(1.18); }

/* landing on a planet */
#planet {
  position: fixed; inset: 0; z-index: 11; overflow: hidden; opacity: 0;
  transition: opacity .5s ease;
}
#planet[hidden] { display: none; }
#planet.landing, #planet.show { opacity: 1; }
#planet-view {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0;
  transform: scale(.04); transform-origin: 50% 50%;
  transition: transform 1.15s cubic-bezier(.16, .8, .2, 1), opacity .45s ease;
}
#planet.landing #planet-view { transform: scale(1); opacity: 1; }
.planet-atmos { position: absolute; inset: 0; width: 100%; height: 100%; }
.planet-atmos {
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 108%, var(--planet-glow, rgba(242, 217, 160, .22)), transparent 55%),
              linear-gradient(to bottom, rgba(2, 4, 10, .5), rgba(2, 4, 10, .15) 38%, rgba(2, 4, 10, .82));
}
#planet[data-kind="photos"]  { --planet-glow: rgba(255, 170, 210, .28); }
#planet[data-kind="feeling"] { --planet-glow: rgba(255, 190, 120, .26); }
#planet[data-kind="why"]     { --planet-glow: rgba(255, 150, 160, .22); }
#planet[data-kind="light"]   { --planet-glow: rgba(150, 200, 255, .26); }
#planet[data-kind="memory"]  { --planet-glow: rgba(242, 217, 160, .24); }
#planet-back {
  position: absolute; z-index: 3; left: max(18px, env(safe-area-inset-left)); top: max(18px, env(safe-area-inset-top));
  padding: 10px 16px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .28);
  background: rgba(5, 8, 18, .5); color: var(--ink); font: inherit; font-size: 12px; letter-spacing: .14em;
  cursor: pointer; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
#planet-back:hover { background: rgba(255, 255, 255, .12); }
#planet-ui {
  position: absolute; z-index: 2; left: 50%; bottom: max(5vh, env(safe-area-inset-bottom));
  transform: translate(-50%, 26px); width: min(680px, calc(100vw - 32px)); max-height: 72vh; overflow: auto;
  padding: 26px 28px; border-radius: 24px; background: rgba(5, 8, 18, .5);
  border: 1px solid rgba(255, 255, 255, .12); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  opacity: 0; transition: transform 1s cubic-bezier(.2, .7, .2, 1), opacity .7s ease;
}
#planet.show #planet-ui { transform: translate(-50%, 0); opacity: 1; }
#planet-kind { margin: 0 0 4px; font-size: 10px; letter-spacing: .34em; text-transform: uppercase; color: var(--gold); opacity: .75; }
#planet-title { margin: 0 0 14px; font-family: 'Great Vibes', cursive; font-weight: 400; font-size: clamp(32px, 6vw, 46px); }
#planet-body { font-family: 'Cormorant Garamond', Georgia, serif; font-size: clamp(18px, 3vw, 22px); line-height: 1.55; }
#planet-body p { margin: 0 0 .7em; }
#planet-body video, #planet-body audio { max-width: 100%; max-height: 30vh; border-radius: 12px; }
#planet-note { margin: 14px 0 0; font-size: 12px; letter-spacing: .12em; opacity: .6; }
.planet-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin: 14px 0 6px; }
.planet-photo {
  position: relative; border-radius: 14px; overflow: hidden; aspect-ratio: 1;
  background: linear-gradient(145deg, rgba(242, 217, 160, .12), rgba(255, 255, 255, .03));
  border: 1px solid rgba(255, 255, 255, .12); animation: photoIn .9s both;
}
.planet-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.planet-photo figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 8px 7px;
  font-family: 'Jost', sans-serif; font-size: 10px; letter-spacing: .08em; color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, .75));
}
.planet-photo.mine { box-shadow: 0 0 0 1px rgba(255, 214, 150, .35); }
.planet-photo.hers { box-shadow: 0 0 0 1px rgba(255, 190, 220, .4); }
.planet-photo .empty { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 26px; opacity: .45; }
@keyframes photoIn { from { opacity: 0; transform: translateY(14px) scale(.94); } }

@media (prefers-reduced-motion: reduce) {
  #brand, #intro, #hall, #hint, #gate, #tonight, #planet, #planet-ui { transition-duration: .01s; }
  .line, .t-line, .planet-photo { animation-duration: .01s; }
  #enter, .seal-ring { animation: none; }
  .constellation-lines path { stroke-dashoffset: 0; }
  .constellation-stars circle { opacity: .75; }
}
