:root {
  --accent: #3457c2;
  --accent-soft: #93aaf0;
  --gold: #e9c97b;
  --bg: #070f26;
  --ink: #ece9e1;
  --muted: #8b92a8;
  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --hand: 'Caveat', 'Segoe Script', cursive;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--serif);
  overflow: hidden auto; -webkit-font-smoothing: antialiased;
  display: grid; place-items: center; padding: 24px;
}
#stars { position: fixed; inset: 0; width: 100%; height: 100%; }
body::after {
  content: ''; position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, .6) 100%);
}

.cd { position: relative; z-index: 1; text-align: center; max-width: 720px; animation: rise 1.4s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.cd-heart-wrap { position: relative; display: inline-block; margin-bottom: 8px; }
.cd-heart-btn { background: none; border: 0; padding: 6px; cursor: pointer; display: block; -webkit-tap-highlight-color: transparent; transition: transform .12s; }
.cd-heart-btn:active { transform: translateY(2px) scale(.94); }
.cd-heart-btn.poked .cd-heart { animation: poked .45s cubic-bezier(.2, 1.6, .3, 1); }
@keyframes poked { 0% { transform: scale(1); } 35% { transform: scale(1.32); } 100% { transform: scale(1); } }
.cd-poke {
  position: absolute; left: 50%; bottom: 100%; transform: translate(-50%, 6px); white-space: nowrap; margin: 0 0 4px; pointer-events: none;
  font: 600 clamp(17px, 2vw, 22px)/1 var(--hand); color: var(--accent-soft); opacity: 0; transition: opacity .3s, transform .3s;
}
.cd-poke.show { opacity: 1; transform: translate(-50%, 0); }
.cd-bit {
  position: fixed; z-index: 5; pointer-events: none; color: var(--accent-soft); font-size: 16px; line-height: 1;
  transform: translate(-50%, -50%) scale(var(--s, 1)); animation: bit .85s ease-out forwards;
}
@keyframes bit { to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.2); opacity: 0; } }
.cd-heart {
  width: 54px; height: 54px; fill: var(--accent); display: block;
  filter: drop-shadow(0 0 18px color-mix(in srgb, var(--accent) 70%, transparent));
  animation: beat 2.6s ease-in-out infinite;
}
@keyframes beat { 0%, 100% { transform: scale(1); } 14% { transform: scale(1.08); } 28% { transform: scale(1); } 42% { transform: scale(1.06); } 56% { transform: scale(1); } }

.cd-hand { font: 600 clamp(30px, 4.5vw, 42px)/1 var(--hand); color: var(--gold); margin: 0 0 26px; transform: rotate(-2deg); }

.cd-clock { display: flex; align-items: flex-start; justify-content: center; gap: clamp(6px, 2vw, 18px); margin: 0 0 30px; }
.cd-unit { display: flex; flex-direction: column; align-items: center; min-width: clamp(56px, 12vw, 110px); }
.cd-num {
  font: 300 clamp(48px, 11vw, 112px)/1 var(--serif); font-variant-numeric: tabular-nums; letter-spacing: -.02em;
  text-shadow: 0 0 30px color-mix(in srgb, var(--accent-soft) 35%, transparent);
  transition: opacity .25s;
}
.cd-num.tick { animation: tick .5s ease; }
@keyframes tick { 0% { opacity: .35; transform: translateY(-4px); } 100% { opacity: 1; transform: none; } }
.cd-lbl { font: 400 clamp(12px, 1.4vw, 15px)/1 var(--serif); font-style: italic; letter-spacing: .18em; color: var(--muted); margin-top: 8px; }
.cd-sep { font: 300 clamp(40px, 9vw, 90px)/1 var(--serif); color: var(--muted); opacity: .5; padding-top: .04em; }

.cd-line { font: 400 clamp(18px, 2vw, 22px)/1.5 var(--serif); color: var(--muted); margin: 0 0 12px; }
.cd-date { font: 400 15px/1 var(--serif); font-style: italic; color: var(--muted); opacity: .7; margin: 0; }

.cd-sign {
  position: fixed; right: 26px; bottom: 20px; margin: 0; z-index: 1;
  font: 500 20px/1 var(--hand); color: var(--muted); opacity: .8; transform: rotate(-3deg);
}

.cd.open .cd-hand { color: var(--accent-soft); }

/* ---- things to do while waiting ---- */
.cd-daily { font: 600 clamp(19px, 2.2vw, 24px)/1.3 var(--hand); color: var(--gold); margin: 18px 0 0; opacity: .9; }
.cd-play { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 14px; margin-top: 18px; }
.cd-btn {
  background: rgba(236, 233, 225, .03); border: 1px solid rgba(147, 170, 240, .3); color: var(--accent-soft); border-radius: 999px;
  padding: 9px 18px; cursor: pointer; font: 400 16px/1 var(--serif); font-style: italic;
  transition: background .2s, border-color .2s, transform .12s, filter .12s; -webkit-tap-highlight-color: transparent;
}
.cd-btn:hover { background: rgba(147, 170, 240, .1); border-color: var(--accent-soft); }
.cd-btn:active { transform: translateY(2px); filter: brightness(.86); }

.cd-panel {
  position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 20px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  animation: fade .25s ease both;
}
.cd-panel[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.cd-panel-in { text-align: center; width: min(92vw, 380px); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.cd-panel-title { font: 600 clamp(28px, 4vw, 36px)/1 var(--hand); color: var(--gold); margin: 0; transform: rotate(-2deg); }
.cd-panel-sub { font: 400 16px/1.4 var(--serif); font-style: italic; color: var(--muted); margin: 0; min-height: 1.4em; }
#game-canvas {
  width: min(92vw, 320px); aspect-ratio: 320 / 400; height: auto; display: block; touch-action: none;
  border: 1px solid rgba(147, 170, 240, .25); border-radius: 18px; background: rgba(236, 233, 225, .02);
}
#note-text {
  width: 100%; resize: vertical; min-height: 130px; padding: 14px 16px; border-radius: 14px;
  border: 1px solid rgba(147, 170, 240, .3); background: rgba(236, 233, 225, .04); color: var(--ink);
  font: 500 20px/1.5 var(--hand); outline: none;
}
#note-text:focus { border-color: var(--accent-soft); }
#note-text::placeholder { color: var(--muted); }

/* ---- Mr. Fluff ---- */
body.has-fluff { padding-bottom: 150px; }
@media (max-width: 600px) { body.has-fluff { padding-bottom: 120px; } }
.cd-chat { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
.cd-chat[hidden] { display: none; }
.cd-chat input {
  width: min(70vw, 300px); padding: 9px 14px; border-radius: 999px; outline: none;
  border: 1px solid rgba(147, 170, 240, .3); background: rgba(236, 233, 225, .04); color: var(--ink);
  font: 500 18px/1 var(--hand);
}
.cd-chat input:focus { border-color: var(--accent-soft); }
.cd-chat input::placeholder { color: var(--muted); }
