:root {
  color-scheme: dark;
  --bg: #090916;
  --ink: #f7f2ff;
  --muted: #bcb4cf;
  --violet: #d9c5ff;
  --pink: #ffc4e3;
  --line: #c8b0ff30;
  --soft: #171528;
  --serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: Inter, system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 1rem/1.65 var(--sans); -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .58; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid #ead5ff; outline-offset: 4px; }
p, h1, h2, h3 { margin: 0; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.18; overflow-wrap: anywhere; }
.wrap { width: min(1160px, calc(100% - 104px)); margin-inline: auto; }
.muted { color: var(--muted); }
.cosmos { position: relative; isolation: isolate; overflow: hidden; background: radial-gradient(ellipse at 72% 45%, #251442 0, #0c0b20 48%, #090916 76%); }
.cosmos::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(90deg, #090916f0 0%, #0909169c 29%, #09091622 61%, #09091620 100%), linear-gradient(0deg, #090916 0%, transparent 35%), url("/nebula.webp");
  background-size: cover;
  background-position: center, center, center 49%;
}
.specks {
  position: absolute; z-index: -1; inset: 0; pointer-events: none; opacity: .7;
  background: radial-gradient(1px 1px at 12% 26%, white, transparent 2px), radial-gradient(1px 1px at 42% 81%, #ddcbff, transparent 2px),
    radial-gradient(2px 2px at 91% 28%, #e8daff, transparent 3px), radial-gradient(1px 1px at 78% 57%, white, transparent 2px),
    radial-gradient(1px 1px at 29% 72%, #ebd7ff, transparent 2px), radial-gradient(2px 2px at 63% 18%, #ffd5ea, transparent 3px),
    radial-gradient(1px 1px at 5% 67%, white, transparent 2px), radial-gradient(2px 2px at 57% 62%, white, transparent 3px);
  background-size: 301px 237px, 223px 312px, 450px 392px, 378px 488px, 299px 198px, 610px 403px, 581px 671px, 730px 590px;
  animation: twinkle 6s ease-in-out infinite alternate;
}
@keyframes twinkle { to { opacity: .31; } }
.planet {
  pointer-events: none; position: absolute; top: 48%; left: 69%; z-index: -2; width: clamp(255px, 36vw, 550px); aspect-ratio: 1;
  border-radius: 50%; transform: translate(-50%, -50%);
  background: radial-gradient(ellipse at 24% 16%, #c6a4ee, #63568a 23%, #201839 46%, #101022 70%);
  border: 1px solid #c9a8ff55;
  box-shadow: 0 0 80px #986cdf3a, inset -40px -40px 90px #050510, inset 8px 6px 38px #ffd3ff57;
}
.planet::before, .planet::after {
  content: ""; position: absolute; inset: 35% -47%; border: 1px solid #dfc5fd9c;
  box-shadow: 0 0 14px #d6baff5e, inset 0 0 16px #c9a6ff4d;
  border-radius: 50%; transform: rotate(-22deg);
}
.planet::after { inset: 32% -54%; opacity: .35; }
.eyebrow { color: var(--violet); font-size: .75rem; letter-spacing: .19em; font-weight: 650; line-height: 1.45; }
.eyebrow span { color: var(--pink); margin-right: .4em; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: .56rem; width: fit-content; min-height: 46px;
  padding: .65rem 1.12rem; border: 1px solid transparent; border-radius: 999px; font-size: .9rem; line-height: 1.35; font-weight: 650;
  transition: box-shadow .2s, background .2s, border-color .2s, transform .2s;
}
.button:hover:not(:disabled) { transform: translateY(-2px); }
.button.primary { color: #1c1231; background: linear-gradient(105deg, #f5bcdf, #d4baff); box-shadow: 0 8px 38px #a67fee2b; }
.button.primary:hover:not(:disabled) { box-shadow: 0 8px 35px #b88df66e; }
.button.outline { color: #f0e4ff; background: #171326b8; border-color: #e2ccff55; }
.button.outline:hover { background: #33254a; border-color: #e3cbff99; }
.button.danger { color: #ffb6d2; background: #471d3a70; border-color: #dd8eae55; }
.button.compact { min-height: 39px; padding: .5rem .83rem; }
.plain { background: transparent; border: 0; color: var(--violet); padding: .3rem .15rem; font-size: .88rem; }
.plain:hover { color: white; text-decoration: underline; text-underline-offset: .22em; }
.brand { display: inline-flex; gap: .68rem; align-items: center; white-space: nowrap; font-size: .95rem; font-weight: 650; letter-spacing: .065em; }
.brand-mark { display: grid; place-items: center; border: 1px solid #dac5ff63; border-radius: 50%; width: 34px; height: 34px; font-size: 1.16rem; color: #f0d2ff; box-shadow: 0 0 14px #b27cf333; }
.gate { min-height: 100svh; display: grid; grid-template-rows: auto 1fr auto; }
.gate-header { display: flex; justify-content: space-between; align-items: center; padding-block: 1.65rem; }
.gate-private { color: #d7c5e9; font-size: .8rem; letter-spacing: .13em; }
.gate-body { display: flex; align-items: center; padding-block: 3rem 4.4rem; }
.gate-card { width: min(100%, 490px); }
.gate-card h1 { font-size: clamp(2.9rem, 6.8vw, 5.2rem); margin: .45em 0 .26em; line-height: 1.1; letter-spacing: .04em; text-shadow: 0 4px 30px #0a081a; }
.gate-card h1 span { color: var(--pink); }
.gate-card > p { color: #d8cde6; }
.gate-card form { margin-top: 2rem; max-width: 345px; }
.gate-card label { display: block; margin-bottom: .48rem; font-size: .86rem; color: #e9dcfc; }
.password-field { display: flex; position: relative; align-items: center; }
.password-field button { position: absolute; right: .85rem; }
.password-field input { padding-right: 4rem; }
.enter-button { margin-top: 1.05rem; min-width: 150px; }
.gate-foot { display: flex; justify-content: space-between; border-top: 1px solid #cdb7fa25; padding-block: .9rem 1.35rem; color: #cbbce4; font-size: .81rem; letter-spacing: .15em; }
input:not([type=file]), textarea {
  width: 100%; min-height: 48px; padding: .64rem .82rem; border: 1px solid #d2baff52; border-radius: 11px; background: #161126d9; color: var(--ink);
}
input::placeholder, textarea::placeholder { color: #a59ab6; }
.topbar { position: relative; z-index: 3; background: #0b0a19; border-bottom: 1px solid #cab8f41c; }
.topbar-inner { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: center; padding-block: .92rem; }
.topbar-inner > button { justify-self: end; }
.topbar nav { display: flex; gap: clamp(1rem, 3.2vw, 2.6rem); color: #d1c7e3; font-size: .88rem; }
.topbar nav a { padding-block: .35rem; }
.topbar nav a:hover { color: white; }
.hero-layout { display: grid; grid-template-columns: .96fr 1.13fr; align-items: center; min-height: 630px; padding-block: 3.2rem 6.5rem; }
.hero-copy { position: relative; z-index: 1; text-shadow: 0 3px 25px #0b081bcc; }
.birthday-date {
  display: inline-block; padding: .32em .8em; margin-top: 1.55rem; font-size: .8rem; letter-spacing: .07em;
  color: #f0d8e9; border-radius: 999px; border: 1px solid #ffc0e84d; background: #271529b8;
}
.hero h1 { margin: .31em 0 .26em; font-size: clamp(3.1rem, 6.1vw, 5.65rem); letter-spacing: .015em; line-height: 1.09; }
.hero-intro { max-width: 24em; color: #e0d3ed; font-size: clamp(1rem, 1.6vw, 1.13rem); white-space: pre-wrap; overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; gap: .7rem; align-items: center; }
.hero .actions { margin-top: 1.8rem; text-shadow: none; }
.star-stage { position: relative; width: 100%; height: clamp(330px, 37vw, 510px); z-index: 2; }
.orbit {
  position: absolute; inset: 23% 6%; border: 1px solid #dac0f465; border-radius: 50%;
  transform: rotate(-24deg); box-shadow: inset 0 0 21px #ab8fff20, 0 0 20px #ab8fff1e;
}
.orbit-two { inset: 17% 1%; transform: rotate(19deg); border-style: dashed; opacity: .6; }
.map-stars { position: absolute; inset: 0 0 44px; }
.map-star {
  display: flex; flex-direction: column; align-items: center; gap: .28rem; position: absolute; translate: -50% -50%;
  min-width: 54px; max-width: 116px; min-height: 52px; background: transparent; border: 0; padding: 0; text-align: center; color: #fff;
}
.map-star .star-icon {
  display: grid; place-items: center; width: 42px; height: 42px; color: #fff0ff; border-radius: 50%; font-size: 1.65rem; line-height: 1;
  background: #7756bd42; border: 1px solid #e3d1ff8f; box-shadow: 0 0 20px #dbafffc1, 0 0 45px #895fd593; text-shadow: 0 0 9px #fff;
  transition: transform .25s, background .25s;
}
.map-star:hover .star-icon { transform: scale(1.22) rotate(18deg); background: #b18df1d8; }
.map-star .star-name {
  display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: .1rem .46rem;
  border: 1px solid #ceb7ff46; border-radius: 999px; font-size: .78rem; color: #f4eaff; background: #140f24d9;
}
.map-star.birth .star-icon { background: #a846805c; border-color: #ffc4e6c3; box-shadow: 0 0 22px #f5a0d9a8, 0 0 42px #f5a0d960; }
.map-info {
  position: absolute; bottom: 0; right: 0; display: flex; align-items: center; gap: 1rem; padding: .35rem .74rem; border-radius: 999px;
  background: #141023d9; border: 1px solid var(--line); font-size: .84rem; color: #e8daff;
}
.map-info .plain { font-size: .81rem; }
.glint { color: var(--pink); padding-right: .2rem; }
.time-panel {
  position: relative; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: -3.25rem;
  padding: 1.35rem 1.7rem; border: 1px solid var(--line); border-radius: 20px;
  background: linear-gradient(111deg, #1c1532, #151329 54%, #1d1529); box-shadow: 0 20px 60px #03030970;
}
.time-copy { display: flex; align-items: center; gap: .95rem; }
.time-copy h2 { font-size: 1.25rem; }
.time-copy p { color: var(--muted); margin-top: .38rem; font-size: .86rem; }
.tiny-orbit { display: grid; place-items: center; color: var(--pink); width: 47px; height: 47px; border: 1px solid #ffc4e847; border-radius: 50%; font-size: 1.45rem; background: #d9b3fe13; }
.time-numbers { display: flex; align-items: center; gap: clamp(.4rem, 1.6vw, 1.2rem); }
.time-numbers > div { display: grid; justify-items: center; min-width: 3.1rem; }
.time-numbers b { font: 450 clamp(1.85rem, 3.5vw, 3.18rem)/1 Georgia, "Times New Roman", serif; letter-spacing: -.04em; font-variant-numeric: tabular-nums; color: #eedbff; }
.time-numbers span { font-size: .82rem; color: #c6bad6; margin-top: .2rem; }
.time-numbers i { font-size: 1.45rem; font-style: normal; color: #947bb4; margin-top: -.7rem; }
.section { scroll-margin-top: 20px; margin-top: clamp(3.8rem, 8.5vw, 7.5rem); }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.36rem; }
.section h2 { font-size: clamp(1.95rem, 4vw, 3.3rem); letter-spacing: .03em; margin-block: .35em .24em; }
.section-head p:last-child, .quest-copy > p:not(.eyebrow) { color: var(--muted); }
.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .95rem; }
.photo-card { min-width: 0; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; color: var(--ink); background: #151321; }
.photo-card button { width: 100%; height: 100%; border: 0; background: transparent; color: inherit; text-align: left; padding: 0; display: flex; flex-direction: column; }
.photo-card button:focus-visible { outline-offset: -4px; }
.photo-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #24203b; transition: filter .24s; display: block; }
.photo-card button:hover img { filter: brightness(1.14); }
.photo-card small { min-width: 0; max-width: 100%; display: block; padding: .6rem .75rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: #e1d4ef; }
.photo-empty {
  min-height: 195px; grid-column: 1 / -1; display: grid; place-items: center; align-content: center; gap: .4rem; padding: 1rem;
  border: 1px dashed #c3a6ef5e; border-radius: 17px; background: radial-gradient(ellipse at 50% 5%, #29203f, #111020 68%);
  text-align: center;
}
.photo-empty b { color: var(--violet); font-weight: 550; font-size: 1.6rem; }
.photo-empty p { color: #ded1ec; }
.quest {
  position: relative; isolation: isolate; display: grid; grid-template-columns: 1fr .75fr; min-height: 320px; align-items: center;
  overflow: hidden; border: 1px solid #c6a5fc42; border-radius: 22px; background: radial-gradient(circle at 78% 62%, #3d255f, #18142c 40%, #121022 70%);
}
.quest-copy { padding: clamp(1.5rem, 4.5vw, 3.7rem); }
.quest-copy > p:not(.eyebrow) { max-width: 29rem; margin-bottom: 1.5rem; }
.quest-art { position: relative; min-height: 240px; display: grid; place-items: center; z-index: -1; }
.quest-gem { font-size: clamp(5rem, 14vw, 11rem); color: #e2c8ff; line-height: 1; text-shadow: 0 0 20px #e1b7ff, 0 0 85px #b588f8; rotate: 15deg; animation: float 5s ease-in-out infinite alternate; }
.quest-trail { position: absolute; inset: 25% 7%; border: 1px solid #cbb0ff7d; border-radius: 50%; rotate: -23deg; box-shadow: 0 0 30px #be91f36b, inset 0 0 30px #be91f322; }
@keyframes float { to { translate: 0 -11px; rotate: 25deg; } }
.footer { display: flex; justify-content: space-between; gap: 1rem; align-items: center; padding-block: 2rem; margin-top: 2.75rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
.dialog { width: min(94vw, 580px); max-height: min(88svh, 900px); padding: 0; border: 1px solid #d2b6ff69; border-radius: 19px; background: #171326; color: var(--ink); box-shadow: 0 12px 80px #070615db; }
.dialog::backdrop { background: #080612c7; backdrop-filter: blur(7px); }
.dialog-shell { position: relative; padding: clamp(1.3rem, 4.5vw, 2.05rem); padding-top: max(1.65rem, 4.5vw); }
.dialog h2 { margin: .42rem 1.2rem .62rem 0; font-size: clamp(1.65rem, 4.4vw, 2.38rem); }
.dialog .eyebrow { padding-right: 1rem; }
.dialog .actions:not(:empty) { margin-top: 1.25rem; }
.close { position: absolute; inset: .68rem .7rem auto auto; width: 39px; height: 39px; border-radius: 50%; border: 1px solid var(--line); color: var(--violet); background: #27203a; font-size: 1.5rem; line-height: 1; }
.close:hover { background: #453057; color: white; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.8; margin-top: .8rem; color: #ece1f7; }
.subdate { color: var(--muted); font-size: .85rem; }
.photo-full { width: 100%; max-height: 57svh; object-fit: contain; border-radius: 9px; margin-top: .6rem; background: #0d0b19; }
.dialog-list { display: grid; gap: .5rem; margin-top: .9rem; }
.list-item { display: flex; justify-content: space-between; gap: 1rem; text-align: left; color: var(--ink); background: #211933; border: 1px solid var(--line); border-radius: 10px; padding: .65rem .8rem; overflow-wrap: anywhere; }
.list-item small { color: var(--muted); flex: 0 0 auto; margin: auto 0; }
.form-row { display: grid; gap: .35rem; margin-top: .85rem; }
.form-row label { color: #e9dcf8; font-size: .88rem; }
.form-row textarea { min-height: 105px; resize: vertical; }
.form-row input[type=file] { max-width: 100%; padding: .52rem 0; }
.form-row input::file-selector-button { border: 1px solid var(--line); background: #362747; color: white; padding: .42rem .6rem; border-radius: 7px; margin-right: .5rem; }
.form-error { min-height: 0; margin-top: .55rem; font-size: .9rem; color: #ffb2cd; }
.form-error:empty { display: none; }
.form-actions { margin-top: 1.1rem; }
.toast { position: fixed; z-index: 9; right: clamp(1rem, 5vw, 2.5rem); bottom: max(1.1rem, env(safe-area-inset-bottom)); max-width: min(86vw, 26rem); padding: .65rem 1rem; border: 1px solid #c5a2fb77; background: #271b3f; border-radius: 13px; box-shadow: 0 10px 45px #080610d6; font-size: .9rem; }
.game-dialog { width: min(93vw, 690px); }
.game-hud { display: flex; justify-content: space-between; gap: .5rem; color: var(--violet); font-size: .88rem; margin-top: 1rem; }
.game-sky {
  position: relative; isolation: isolate; overflow: hidden; width: 100%; height: clamp(235px, 47svh, 370px); margin-top: .55rem; border: 1px solid var(--line); border-radius: 14px;
  background: radial-gradient(ellipse at 75% 70%, #39255caa, transparent 54%), radial-gradient(ellipse at 30% 30%, #302044aa, #111026 75%);
}
.game-sky::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .7;
  background: radial-gradient(1px 1px at 22% 34%, #fff, transparent 2px) 0 0 / 111px 91px, radial-gradient(1px 1px at 82% 69%, #dac5fb, transparent 2px) 0 0 / 83px 65px;
}
.game-star {
  display: grid; place-items: center; position: absolute; translate: -50% -50%; width: clamp(42px, 9vw, 60px); aspect-ratio: 1;
  color: #f5e4ff; border: 1px solid #e3bdffad; border-radius: 50%; background: #74419965; box-shadow: 0 0 25px #c886ff80;
  font-size: 1.6rem; line-height: 1; animation: spawn .35s ease-out both;
}
.game-star:nth-child(2n) { animation-delay: .08s; }
.game-star:hover { background: #9a64bd; }
.game-star.decoy { color: #bdd4ef; background: #2440586e; border-color: #a3c9e05e; box-shadow: 0 0 10px #9dc6f42e; }
@keyframes spawn { from { opacity: 0; scale: .65; } to { opacity: 1; scale: 1; } }
.particle { position: absolute; pointer-events: none; width: 5px; height: 5px; border-radius: 50%; background: #e8bdfd; box-shadow: 0 0 8px #ffbdeb; animation: burst .58s ease-out both; }
@keyframes burst { to { transform: translate(var(--dx), var(--dy)); opacity: 0; } }
.game-reveal { text-align: center; padding: 1.2rem .2rem .7rem; }
.game-reveal h3 { font-size: 1.55rem; margin: .8rem 0 .4rem; color: #ffe0f1; }
.game-reveal p { color: var(--muted); }
.heart-grid { width: min(68%, 175px); margin: .45rem auto 1.1rem; display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.heart-grid span { aspect-ratio: 1; border-radius: 3px; }
.heart-grid .lit { background: linear-gradient(145deg, #ffe0f4, #c880ed); box-shadow: 0 0 11px #dba3fc98; animation: spawn .55s ease-out backwards; animation-delay: var(--delay); }

@media (max-width: 850px) {
  .wrap { width: calc(100% - 50px); }
  .hero-layout { min-height: 535px; }
  .topbar-inner { gap: .45rem; }
  .topbar nav { gap: .75rem; }
}
@media (max-width: 660px) {
  .wrap { width: calc(100% - 34px); }
  .gate-header { padding-block: 1.12rem; }
  .gate-body { padding-block: 7rem 3rem; }
  .cosmos::before {
    background-image: linear-gradient(0deg, #090916 0%, #09091646 43%, #09091666 77%, #090916b8 100%), linear-gradient(90deg, #09091663, transparent), url("/nebula.webp");
    background-size: cover, cover, auto 82%;
    background-repeat: no-repeat;
    background-position: center, center, 62% 33%;
  }
  .gate::before { background-position: center, center, 61% 13%; background-size: cover, cover, auto 76%; }
  .gate .planet { top: 33%; left: 67%; }
  .gate-card h1 { font-size: clamp(2.7rem, 12vw, 4.7rem); }
  .gate-card > p { text-shadow: 0 2px 12px #080510; }
  .gate-foot { padding-block: .7rem 1rem; }
  .topbar-inner { grid-template-columns: 1fr auto; row-gap: .6rem; padding-block: .65rem .35rem; }
  .topbar nav { order: 3; grid-column: 1 / -1; justify-content: space-between; border-top: 1px solid #cbb5f521; }
  .topbar-inner > button { grid-column: 2; grid-row: 1; }
  .hero-layout { grid-template-columns: 1fr; min-height: auto; padding-block: 2.4rem 4.2rem; }
  .hero h1 { font-size: clamp(2.75rem, 12vw, 4.7rem); }
  .hero .actions { margin-top: 1.14rem; }
  .hero-copy .eyebrow { font-size: .72rem; }
  .birthday-date { margin-top: .95rem; }
  .hero .planet { top: 64%; left: 55%; }
  .star-stage { height: clamp(255px, 74vw, 355px); margin-top: .6rem; }
  .map-star .star-icon { width: 35px; height: 35px; font-size: 1.2rem; }
  .map-star .star-name { max-width: 85px; font-size: .72rem; }
  .map-info { bottom: .36rem; }
  .time-panel { flex-direction: column; align-items: stretch; gap: .95rem; padding: .92rem 1rem 1.08rem; }
  .time-copy { gap: .65rem; }
  .tiny-orbit { width: 37px; height: 37px; font-size: 1.18rem; }
  .time-copy h2 { font-size: 1.08rem; }
  .time-copy p { margin-top: .14rem; }
  .time-numbers { justify-content: space-between; border-top: 1px solid var(--line); padding-top: .8rem; }
  .time-numbers > div { min-width: 2.5rem; }
  .time-numbers b { font-size: clamp(1.8rem, 9vw, 2.55rem); }
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
  .photo-card { border-radius: 12px; }
  .section-head { align-items: start; flex-direction: column; }
  .quest { grid-template-columns: 1fr; min-height: 0; }
  .quest-copy { padding: 1.42rem; padding-right: 1.3rem; }
  .quest-art { min-height: 120px; }
  .quest-gem { font-size: 5.4rem; }
  .quest-trail { inset: 23% 22%; }
  .footer { margin-top: 2rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-delay: 0ms !important; }
}
