/* lunar minimal — apex */

:root {
  --bg: #0a0a0c;
  --paper: #e8e6df;
  --champagne: #c9a961;
  --hairline: rgba(232, 230, 223, 0.12);
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--paper);
  font-family: 'EB Garamond', Georgia, serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
}

/* ambient gradient — barely there */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 70% 30%, rgba(201, 169, 97, 0.05), transparent 60%),
    radial-gradient(ellipse at 20% 80%, rgba(201, 169, 97, 0.03), transparent 55%);
  pointer-events: none;
  z-index: 0;
}

main {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2rem;
  max-width: 36rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.25rem;
  transition: opacity 600ms ease, transform 600ms ease;
}

main.fading {
  opacity: 0;
  transform: scale(0.98);
  pointer-events: none;
}

/* crescent button */
.crescent-btn {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 200ms ease, filter 200ms ease;
}

.crescent-btn:hover { transform: scale(1.04); }
.crescent-btn:active { transform: scale(0.96); }
.crescent-btn:focus-visible {
  outline: 1px solid var(--champagne);
  outline-offset: 8px;
  border-radius: 50%;
}

/* crescent — the shadow drifts */
.crescent {
  width: 84px;
  height: 84px;
  filter: drop-shadow(0 0 24px rgba(201, 169, 97, 0.18));
  display: block;
}

.crescent .shadow {
  animation: phase 24s ease-in-out infinite;
  transform-origin: 50% 50%;
}

@keyframes phase {
  0%, 100% { transform: translateX(0); }
  50%      { transform: translateX(-4px); }
}

/* visual cue when nearing the secret — accumulates with click count */
.crescent-btn[data-clicks="1"] .crescent { filter: drop-shadow(0 0 32px rgba(201, 169, 97, 0.32)); }
.crescent-btn[data-clicks="2"] .crescent { filter: drop-shadow(0 0 44px rgba(201, 169, 97, 0.55)); }

/* the poem */
.poem {
  margin: 0;
  font-size: clamp(1.1rem, 2.6vw, 1.45rem);
  line-height: 1.9;
  letter-spacing: 0.01em;
  color: var(--paper);
  opacity: 0.92;
  font-weight: 400;
}

.poem em {
  font-style: italic;
}

/* footer */
footer {
  margin-top: 0.5rem;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: lowercase;
  color: var(--paper);
  opacity: 0.4;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

footer .dot {
  color: var(--champagne);
  opacity: 0.7;
}

@media (prefers-reduced-motion: reduce) {
  .crescent .shadow { animation: none; }
  main { transition: none; }
}

/* hairline border for taste */
main::after {
  content: "";
  position: absolute;
  inset: -2.5rem;
  border: 1px solid var(--hairline);
  border-radius: 2px;
  pointer-events: none;
  opacity: 0.5;
}

/* ============================================================ */
/* danmaku stage                                                */
/* ============================================================ */

.stage {
  position: fixed;
  inset: 0;
  background: #06060a;
  display: none;
  z-index: 10;
  touch-action: none;
}

.stage.on { display: block; }

.stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(201, 169, 97, 0.08), transparent 60%),
    radial-gradient(ellipse at 50% 100%, rgba(201, 169, 97, 0.04), transparent 70%),
    #06060a;
}

.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: lowercase;
  color: var(--paper);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hud-row { display: flex; justify-content: space-between; opacity: 0.55; }
.hud-row.top { gap: 1rem; }
.hud-row.bottom { font-size: 0.66rem; opacity: 0.32; }

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  text-align: center;
  background: rgba(6, 6, 10, 0.78);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  transition: opacity 400ms ease;
  padding: 1rem;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay-title {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  margin: 0;
  color: var(--paper);
}
.overlay-title em { font-style: italic; }

.overlay-sub {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  text-transform: lowercase;
  color: var(--paper);
  opacity: 0.55;
  margin: 0;
}
