:root {
  --bg: #070b1a;
  --panel: #0c1228;
  --ink: #f6f0e6;
  --muted: #9aa4c4;
  --pink: #e878bc;
  --cyan: #5adce6;
  --gold: #e4c07a;
  --line: rgba(90, 220, 230, 0.22);
  --sans: "Noto Sans SC", "PingFang SC", sans-serif;
  --pix: "Press Start 2P", ui-monospace, monospace;
  --char-h: 250px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
}
html { scroll-behavior: smooth; }
body {
  background:
    radial-gradient(ellipse 80% 50% at 50% -8%, #4a1a58 0%, transparent 55%),
    radial-gradient(ellipse 40% 30% at 100% 20%, #1a2048 0%, transparent 50%),
    var(--bg);
}
.grid-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(90,220,230,.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(90,220,230,.07) 1px, transparent 1px);
  background-size: 28px 28px;
}
.sparkles {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: radial-gradient(circle, rgba(255,210,240,.35) 1px, transparent 1.5px);
  background-size: 54px 54px;
}
button, input, textarea { font-family: inherit; }
img.pixel { image-rendering: pixelated; image-rendering: crisp-edges; }

.pix-label {
  font-family: var(--pix);
  font-size: 10px;
  letter-spacing: .12em;
  color: var(--cyan);
}
.muted { color: var(--muted); }
.lead { color: var(--muted); margin: 8px 0 18px; line-height: 1.7; }
.err { color: #ff8aa0; margin-top: 10px; }
.hidden { display: none !important; }

.buddy {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  flex: 0 0 auto;
  height: var(--char-h);
  overflow: visible;
}
.buddy img {
  height: var(--char-h);
  width: auto;
  object-fit: contain;
  object-position: bottom center;
}
.pair, .stage, .runway, .intro-pair {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
}
.ground {
  height: 10px;
  max-width: 520px;
  margin: 0 auto 16px;
  background: linear-gradient(90deg, transparent, var(--pink), var(--cyan), transparent);
  border-radius: 8px;
  opacity: .7;
}

#gate { z-index: 50; }
.overlay {
  position: fixed; inset: 0; z-index: 40;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; text-align: center; padding: 24px;
  background: rgba(7,11,26,.94);
}
.overlay h1 { font-size: clamp(28px, 6vw, 44px); }
.intro-heart { width: min(280px, 70vw); margin-top: -8px; }

.app { position: relative; z-index: 1; padding-bottom: 100px; }
.app.is-locked { filter: blur(10px); pointer-events: none; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(7,11,26,.75);
  position: sticky; top: 0; z-index: 10;
}
.nav { display: flex; flex-wrap: wrap; gap: 10px 14px; }
.nav a { color: var(--gold); text-decoration: none; font-size: 14px; }
.nav a:hover { color: var(--pink); }

.hero, .panel { max-width: 1100px; margin: 0 auto; padding: 36px 18px; }
.hero { text-align: center; padding-top: 28px; }
.hero-deco {
  display: flex; justify-content: center; gap: 18px; margin-bottom: 8px;
}
.hero-deco .deco { height: 72px; width: auto; opacity: .95; }
.stage { min-height: var(--char-h); margin-bottom: 8px; }
.hero-num {
  font-size: clamp(64px, 16vw, 132px);
  font-weight: 700; color: var(--pink); line-height: .9; margin: 6px 0;
  text-shadow: 0 0 28px rgba(232,120,188,.4);
}
.hero-sub { font-size: 22px; margin-top: 8px; }
.hero-since, .hero-note { color: var(--muted); margin-top: 8px; }
.clock {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  max-width: 520px; margin: 20px auto 0;
}
.clock div, .stat-grid article {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 8px;
}
.clock b { display: block; font-size: 24px; color: var(--gold); }
.clock span, .stat-grid span { font-size: 12px; color: var(--muted); }
.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  margin-top: 18px;
}
.stat-grid b { display: block; font-size: 22px; color: var(--pink); }

.parade {
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(12,18,40,.8);
  padding: 18px 0 10px;
}
.parade-track {
  display: flex; align-items: flex-end; gap: 28px;
  width: max-content;
  animation: parade 28s linear infinite;
}
.parade-track .buddy,
.parade-track .buddy img { height: 168px; }
@keyframes parade {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.panel h2 { margin: 8px 0 0; font-size: 28px; }
.outfit-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 16px 0 12px;
}
.outfit-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px 8px 12px;
  cursor: pointer;
  color: var(--ink);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.outfit-card.is-on { border-color: var(--pink); box-shadow: 0 0 0 1px var(--pink) inset; }
.outfit-card .buddy,
.outfit-card .buddy img { height: 150px; }
.outfit-card span { font-size: 14px; }

.runway {
  margin-top: 16px; min-height: 300px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: 16px 12px 8px;
  gap: 10px;
}

.action-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: transparent; color: var(--ink);
  border-radius: 999px; padding: 7px 12px; cursor: pointer;
}
.chip.is-on { border-color: var(--pink); color: var(--pink); background: rgba(232,120,188,.12); }

.move-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.move-grid figure, .face-row figure {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 10px 8px 12px; text-align: center;
}
.move-grid figcaption, .face-row figcaption { margin-top: 6px; font-size: 13px; color: var(--muted); }
.move-grid .buddy,
.move-grid .buddy img { height: 180px; }

.face-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 16px;
}
.face { height: 110px; width: auto; }
.couple-face { height: 90px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--cyan); background: transparent; color: var(--ink);
  border-radius: 10px; padding: 10px 14px; cursor: pointer;
}
.btn-pink { border-color: var(--pink); background: rgba(232,120,188,.16); color: #ffd7ef; }
.btn-ghost { border-color: var(--line); color: var(--muted); }
.btn-tiny { padding: 4px 8px; font-size: 13px; }
label.btn { cursor: pointer; }

.event-list {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0 18px;
}
.event-card, .ghost-card, .photo-card, .ghost-photo {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
}
.event-card { padding: 16px 16px 12px; position: relative; }
.event-card time { color: var(--gold); font-size: 13px; }
.event-card h3 { margin: 6px 0; }
.event-card p { color: var(--muted); line-height: 1.6; }
.event-card img { width: 100%; max-height: 220px; object-fit: cover; border-radius: 10px; margin-top: 10px; }
.ghost-card {
  border-style: dashed; color: var(--muted); padding: 22px; min-height: 110px;
  display: flex; align-items: center; justify-content: center; text-align: center;
}
.del {
  position: absolute; top: 10px; right: 10px;
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
}

.album-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 12px; margin: 16px 0;
}
.photo-card { overflow: hidden; position: relative; }
.photo-card img { width: 100%; height: 170px; object-fit: cover; display: block; }
.photo-card figcaption { padding: 8px 10px 10px; font-size: 13px; color: var(--muted); }
.ghost-photo {
  border-style: dashed; min-height: 170px;
  display: grid; place-items: center; color: var(--muted); font-size: 13px;
}
.dropzone {
  border: 1px dashed var(--pink); border-radius: 14px; padding: 22px;
  text-align: center; color: var(--muted);
}

.letter-wrap {
  display: grid;
  grid-template-columns: 120px 1fr 120px;
  gap: 8px; align-items: end;
}
.paper {
  background: #f3ead8; color: #3a2a22; border-radius: 14px; padding: 22px;
  white-space: pre-wrap; line-height: 1.9;
}
.peek { justify-self: center; }
.peek, .peek img { height: 160px; }

.ending { text-align: center; padding: 28px 18px 120px; color: var(--muted); }
.ending-heart { width: min(320px, 78vw); margin: 8px auto 12px; display: block; }

.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  padding: 12px; background: rgba(7,11,26,.94); border-top: 1px solid var(--line);
}
.modal {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(0,0,0,.55);
  display: grid; place-items: center; padding: 16px;
}
.modal-card {
  width: min(460px, 100%); background: #10182f; border: 1px solid var(--pink);
  border-radius: 16px; padding: 22px 20px 18px; position: relative;
}
.modal-x {
  position: absolute; top: 8px; right: 10px; border: 0; background: none;
  color: var(--ink); font-size: 24px; cursor: pointer;
}
form h3 { margin-bottom: 12px; }
form label { display: block; margin: 10px 0; color: var(--muted); font-size: 13px; }
form input, form textarea {
  display: block; width: 100%; margin-top: 6px; padding: 8px 10px;
  border-radius: 8px; border: 1px solid var(--line); background: #070b1a; color: var(--ink);
}
.music-btn {
  position: fixed; right: 14px; bottom: 70px; z-index: 21;
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--gold); background: var(--panel); color: var(--gold); cursor: pointer;
}

@media (max-width: 860px) {
  .outfit-grid, .move-grid, .face-row, .album-grid, .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .event-list { grid-template-columns: 1fr; }
  .letter-wrap { grid-template-columns: 1fr; }
  .peek { display: none; }
  .nav { display: none; }
  :root { --char-h: 200px; }
}
@media (max-width: 700px) {
  .clock { grid-template-columns: repeat(2, 1fr); }
}
