/* 크리스마스 D-day. 모바일 먼저: 위 글자 · 가운데 트리(캔버스) · 아래 버튼과 노래 */
body {
  overflow: hidden;
  /* 밤하늘은 캔버스가 아니라 여기서(성능 규칙) */
  background: linear-gradient(180deg, #070b26 0%, #10164a 42%, #262766 74%, #3a3474 100%) #0b1030;
  min-height: 100dvh;
}
body.is-christmas { background: linear-gradient(180deg, #0a0c2c 0%, #1a1550 45%, #3a2a70 78%, #5a3a7a 100%) #0b1030; }
.scene { position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; }
#bg { pointer-events: none; }

.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(12px + env(safe-area-inset-top)) 16px 0;
  pointer-events: none;
}
.top > * { pointer-events: auto; }
.lang { appearance: none; -webkit-appearance: none; color: var(--ink); font: inherit; font-size: 13px; font-weight: 600; padding: 7px 26px 7px 13px;
  background: rgba(20, 22, 60, 0.55) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23fff' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 10px center; }
.lang option { color: #111; }

.count {
  position: relative; z-index: 2;
  max-width: 480px; margin: 0 auto;
  padding: calc(56px + env(safe-area-inset-top)) 16px 0;
  text-align: center;
  pointer-events: none;
}
.label { margin: 0; font-size: 15px; font-weight: 600; color: var(--ink-soft); letter-spacing: 0.04em; }
.big {
  position: relative;
  margin: 2px 0 0;
  font-size: clamp(64px, 23vw, 128px);
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
  color: #fff8ea;
  text-shadow: 0 0 34px rgba(255, 214, 130, 0.38);
  animation: popIn 1.3s var(--ease) both;
}
/* 숫자 뒤 따스한 후광(숨 쉬듯) */
.big::before {
  content: ''; position: absolute; left: 50%; top: 50%; width: 3.4em; height: 2.2em; z-index: -1;
  transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 196, 120, 0.34), rgba(255, 170, 110, 0.12) 55%, transparent);
  animation: halo 4.5s ease-in-out infinite; will-change: transform, opacity; pointer-events: none;
}
.big.pop { animation: popIn 1.1s var(--ease) both; }
/* 작게 시작 → 살짝 더 커졌다가 → 제 크기 */
@keyframes popIn {
  0% { opacity: 0; transform: scale(0.45); }
  55% { opacity: 1; transform: scale(1.1); }
  75% { transform: scale(0.97); }
  100% { transform: scale(1); }
}
@keyframes halo { 0%, 100% { opacity: 0.75; transform: translate(-50%, -50%) scale(0.92); } 50% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); } }
.big small { display: block; font-size: 0.2em; letter-spacing: 0.06em; font-weight: 700; color: var(--gold); margin-top: 6px; text-shadow: none; }
.is-christmas .big { font-size: clamp(42px, 12vw, 84px); letter-spacing: -0.03em; color: #ffe9a8; }
.left { margin: 10px 0 0; font-size: 19px; contain: layout paint; font-weight: 600; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.left .n { display: inline-block; min-width: 1.25em; color: var(--ink); font-weight: 800; will-change: transform; }
.left .n.tick { animation: tick 0.45s var(--ease); }
.today { margin: 16px auto 0; max-width: 340px; animation: rise 1.1s 0.15s var(--ease) both; }
.kicker { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; color: var(--gold); text-transform: uppercase; }
.line { margin: 6px 0 0; font-size: 15px; line-height: 1.5; color: var(--ink); text-wrap: balance; }
.hint {
  margin: 10px 0 0; font-size: 12px; color: var(--ink-faint);
  transition: opacity 0.8s var(--ease); animation: rise 1s 1.2s var(--ease) both;
}
.hint.gone { opacity: 0; }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes tick { from { opacity: 0.2; transform: translateY(-0.35em); } }

/* 아래: 소원·공유 + 노래 */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 4;
  padding: 0 16px calc(14px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 10px; align-items: center;
  pointer-events: none;
}
.dock > * { pointer-events: auto; width: 100%; max-width: 440px; }
.acts { display: flex; gap: 8px; justify-content: center; }
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 16px; border-radius: 999px;
  background: rgba(14, 16, 48, 0.7); border: 1px solid var(--glass-line);
  font-size: 14px; font-weight: 700;
  transition: transform 0.2s var(--ease);
}
.pill svg { width: 18px; height: 18px; }
.pill:active { transform: scale(0.96); }

.player {
  position: relative;
  background: var(--glass); border: 1px solid var(--glass-line);
  border-radius: 22px; min-height: 68px;
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 10px;
  overflow: hidden;
  animation: rise 0.9s 0.3s var(--ease) both;
}
.player.off { flex-direction: column; gap: 4px; padding: 8px; }
.player .start {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 6px 8px; border-radius: 16px;
}
.player .start i {
  flex: none; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(135deg, #ff6b7a, #ffb36b); color: #fff;
  animation: glow 2.4s ease-in-out infinite; will-change: transform;
}
.player .start b { display: block; font-size: 16px; }
.player .start small { display: block; font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
@keyframes glow { 50% { transform: scale(1.06); } }

.player .art {
  flex: none; width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, hsl(var(--h) 80% 66%), hsl(calc(var(--h) + 40) 70% 46%));
}
.player.playing .art svg { animation: bob 1.6s ease-in-out infinite; will-change: transform; }
@keyframes bob { 50% { transform: translateY(-3px) rotate(-6deg); } }
.player .meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.player .title { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player .foot { font-size: 12px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.player .foot .num { margin-left: 8px; }
.player .ctl {
  flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.08);
}
.player .ctl[data-act='toggle'] { background: #fff4dc; color: #1a1640; }
.player .ctl:active { transform: scale(0.94); }
.player .prog { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255, 255, 255, 0.06); }
.player .prog i { display: block; height: 100%; background: linear-gradient(90deg, #ff8a7a, var(--gold)); transform-origin: left; transform: scaleX(0); will-change: transform; }

/* 소원 말풍선 */
.bubble {
  position: fixed; z-index: 6; left: var(--x); top: var(--y);
  transform: translate(-50%, calc(-100% + 8px)) scale(0.92); opacity: 0;
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
  background: #fffaf0; color: #1a1640; border-radius: 16px; padding: 10px 12px 8px;
  max-width: 220px; text-align: center; border-top: 4px solid var(--c, #ffd36b);
}
.bubble.show { opacity: 1; transform: translate(-50%, -100%) scale(1); }
.bubble p { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.4; word-break: keep-all; overflow-wrap: anywhere; }
.bubble .mini { margin-top: 6px; font-size: 12px; color: #6a6590; text-decoration: underline; }

/* 아래에서 올라오는 시트(소원 쓰기·공유) */
.sheet-wrap {
  position: fixed; inset: 0; z-index: 20; background: rgba(4, 5, 20, 0);
  display: flex; align-items: flex-end; justify-content: center;
  transition: background 0.3s var(--ease);
}
.sheet-wrap.show { background: rgba(4, 5, 20, 0.55); }
.sheet {
  position: relative; width: 100%; max-width: 480px;
  background: #151846; border: 1px solid var(--glass-line); border-bottom: 0;
  border-radius: 26px 26px 0 0; padding: 22px 18px calc(20px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform 0.35s var(--ease); will-change: transform;
}
.sheet-wrap.show .sheet { transform: none; }
.sheet h2 { margin: 0 0 14px; font-size: 18px; }
.sheet .x { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, 0.08); }
.sheet textarea {
  width: 100%; resize: none; font: inherit; font-size: 16px; color: var(--ink);
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--glass-line); border-radius: 14px; padding: 12px 14px;
}
.sheet textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.sheet .dots { display: flex; gap: 10px; margin: 14px 0; justify-content: center; }
.sheet .dot { width: 30px; height: 30px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff 0 8%, var(--c) 30%, #1a1040 100%); border: 2px solid transparent; transition: transform 0.2s var(--ease); }
.sheet .dot.on { border-color: #fff; transform: scale(1.12); }
.sheet .primary {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px; border-radius: 16px; font-weight: 800; font-size: 16px;
  background: linear-gradient(135deg, #ffe3a3, #ffb36b); color: #2a1640;
}
.sheet .note { margin: 12px 0 0; font-size: 12.5px; color: var(--ink-faint); text-align: center; }
.sheet h2 + .note { margin: -6px 0 14px; text-align: left; font-size: 14px; color: var(--ink-soft); }
.sns { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 12px 6px; }
.sn { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-soft); }
.sn i { width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, 0.08); color: #fff; }
.sn-kakao i { background: #fee500; color: #3a1d1d; }
.sn-x i { background: #000; }
.sn-threads i { background: #101010; }
.sn-facebook i { background: #1877f2; }

/* 낮은 화면: 글자를 줄여 트리 자리를 남긴다 */
@media (max-height: 700px) {
  .count { padding-top: calc(48px + env(safe-area-inset-top)); }
  .big { font-size: clamp(54px, 18vw, 96px); }
  .today { margin-top: 10px; }
  .line { font-size: 14px; }
  .hint { display: none; }
}
@media (max-height: 560px) {
  .today { display: none; }
}
@media (min-width: 900px) {
  .count { padding-top: 72px; }
}

/* 알림은 노래 카드 위에 */
#toast { bottom: calc(160px + env(safe-area-inset-bottom)); }

/* 미리보기 이미지(1200×630) 촬영용: ?og=1 */
body.og .top, body.og .dock, body.og .today, body.og .hint, body.og .left { display: none !important; }
body.og .count { position: fixed; left: 70px; top: 0; bottom: 0; margin: 0; width: 560px; max-width: none; padding: 0; display: flex; flex-direction: column; justify-content: center; text-align: left; }
body.og .label { font-size: 30px; color: var(--gold); letter-spacing: 0.02em; }
body.og .big { font-size: 92px; letter-spacing: -0.035em; line-height: 1.02; margin-top: 14px; animation: none; }
body.og .og-sub { margin: 22px 0 0; font-size: 30px; font-weight: 600; color: var(--ink-soft); }
