/* 生日快乐 · 深夜星空 + 3D 暖金粒子 */

/* 手写行楷子集（仅含「生日快乐吴金航」7 字，3.6 KB，离线可用） */
@font-face {
  font-family: 'HandBirth';
  src: url('fonts/handwriting.woff2') format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  --bg: #060a1a;
  --gold: #ffd98a;
  --gold-bright: #ffe9bd;
  --gold-dim: #c9a86a;
  --ink: #f7efdd;
  --line: rgba(255, 214, 140, 0.28);
  --card: rgba(12, 18, 40, 0.88);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  width: 100%; height: 100%; margin: 0; padding: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

#bg, #scene {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
}
#bg { z-index: 0; }
/* 拖动旋转需要接管所有触摸手势 */
#scene { z-index: 1; touch-action: none; cursor: grab; }
#scene:active { cursor: grabbing; }

/* 顶部文字全由 canvas 粒子绘制，这里只是无障碍热区 */
#hero {
  position: fixed; top: 0; left: 0; right: 0;
  height: 30vh;
  z-index: 2;
  pointer-events: none;
}

/* ---------- 顶部英文：与副文案同款衬线渐变艺术字 ---------- */
.eyebrow-art {
  position: fixed;
  left: 0; right: 0;
  z-index: 3;
  text-align: center;
  transform: translateY(-50%);
  font-family: Georgia, "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  font-size: clamp(10px, 2.9vw, 13px);
  font-weight: 400;
  letter-spacing: 0.52em;
  text-indent: 0.52em;
  color: #ffe7bd;
  background: linear-gradient(180deg, #fff8e8 0%, #ffd9a0 55%, #e0a860 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 8px rgba(255, 190, 110, 0.35));
  pointer-events: none;
  white-space: nowrap;
  opacity: .88;
}

/* ---------- 副文案：非粒子的金色衬线艺术字 ---------- */
.subtitle {
  position: fixed;
  left: 0; right: 0;
  z-index: 3;
  text-align: center;
  font-family: Georgia, "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  font-size: clamp(15px, 4.2vw, 19px);
  font-weight: 400;
  letter-spacing: 0.38em;
  text-indent: 0.38em;
  color: #ffe7bd;
  background: linear-gradient(180deg, #fff8e8 0%, #ffd9a0 55%, #e0a860 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 12px rgba(255, 190, 110, 0.45));
  pointer-events: none;
  white-space: nowrap;
}
.subtitle::before, .subtitle::after {
  content: '';
  display: inline-block;
  width: clamp(22px, 7vw, 38px);
  height: 1px;
  vertical-align: middle;
  margin: 0 clamp(10px, 3vw, 16px);
  background: linear-gradient(90deg, transparent, rgba(255, 214, 150, 0.75), transparent);
}

/* ---------- 蛋糕下方的弹幕祝福语 ---------- */
#danmaku {
  position: fixed;
  left: 0; right: 0;
  top: 69%;
  height: 132px;
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
}
.dm {
  position: absolute;
  left: 0; top: 0;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(10, 16, 36, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  color: var(--gold-bright);
  font-size: clamp(11px, 3.1vw, 13px);
  line-height: 1.4;
  letter-spacing: 0.04em;
  white-space: nowrap;
  text-shadow: 0 0 12px rgba(255, 190, 90, 0.5);
  box-shadow: 0 0 16px rgba(255, 180, 70, 0.06);
  will-change: transform;
}
.dm-name { margin-left: 8px; color: var(--gold-dim); font-size: 0.86em; }
.dm.pinned { border-color: rgba(255, 226, 160, 0.6); }
.dm.is-new {
  animation: dmIn 2.6s ease-out both;
  border-color: rgba(255, 226, 160, 0.85);
  box-shadow: 0 0 26px rgba(255, 200, 100, 0.55);
}
@keyframes dmIn {
  0%   { filter: brightness(2.2); }
  100% { filter: brightness(1); }
}
.dm.celebrate { border-color: rgba(255, 236, 180, .9); box-shadow: 0 0 30px rgba(255, 200, 100, .6); }

/* 底部交互提示 */
.hint {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(86px + var(--safe-bottom));
  z-index: 4;
  margin: 0;
  text-align: center;
  font-size: clamp(10px, 2.7vw, 11px);
  letter-spacing: 0.14em;
  color: rgba(255, 217, 138, 0.46);
  pointer-events: none;
  transition: opacity .5s;
}

/* ---------- 微信提示 ---------- */
#wechatTip {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 6;
  padding: 8px 36px 8px 12px;
  background: rgba(20, 26, 48, 0.92);
  color: rgba(247, 239, 221, 0.75);
  font-size: 11px;
  text-align: center;
  border-bottom: 1px solid var(--line);
}
#wechatTip button {
  position: absolute; right: 8px; top: 4px;
  border: 0; background: none; color: inherit;
  font-size: 18px; line-height: 1; padding: 2px 6px;
}

/* ---------- 底部工具条 ---------- */
.toolbar {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(22px + var(--safe-bottom));
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 0 16px;
}
button { font-family: inherit; cursor: pointer; }
.primary {
  border: 1px solid rgba(255, 226, 160, 0.75);
  border-radius: 999px;
  padding: 13px 30px;
  font-size: 15px;
  letter-spacing: 0.12em;
  color: #2a1c08;
  background: linear-gradient(135deg, #ffe9bd, #ffc46a);
  box-shadow: 0 6px 26px rgba(255, 180, 70, 0.28);
  transition: transform .15s, box-shadow .15s;
}
.primary:active { transform: scale(0.96); }
.primary:disabled { opacity: .55; }
.round {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(12, 18, 40, 0.7);
  color: var(--gold);
  font-size: 19px;
  line-height: 1;
  display: grid; place-items: center;
  transition: transform .15s, background .2s;
}
.round:active { transform: scale(0.92); }
.round.on { background: rgba(255, 200, 100, 0.18); box-shadow: 0 0 18px rgba(255, 190, 90, .35); }
.ghost {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 16px;
  background: transparent;
  color: var(--gold);
  font-size: 13px;
}

/* ---------- 弹层 ---------- */
.sheet {
  position: fixed; inset: 0;
  z-index: 8;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(3, 6, 16, 0.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fadeIn .22s ease-out;
}
.sheet[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.sheet-card {
  position: relative;
  width: 100%;
  max-width: 460px;
  padding: 30px 22px calc(26px + var(--safe-bottom));
  border-radius: 24px 24px 0 0;
  border: 1px solid var(--line);
  border-bottom: 0;
  background: var(--card);
  box-shadow: 0 -12px 50px rgba(0, 0, 0, .55);
  animation: slideUp .28s cubic-bezier(.2,.8,.2,1);
}
@keyframes slideUp { from { transform: translateY(30px); opacity: .4; } to { transform: none; opacity: 1; } }
.sheet-card--wide { max-width: 560px; max-height: 78vh; display: flex; flex-direction: column; }
.sheet-card h2 {
  margin: 0 0 6px;
  font-family: Georgia, "Songti SC", serif;
  font-weight: 400;
  font-size: 24px;
  letter-spacing: .1em;
  color: var(--gold-bright);
}
.sheet-sub { margin: 0 0 20px; font-size: 12px; color: rgba(247,239,221,.5); }
.close {
  position: absolute; right: 14px; top: 12px;
  border: 0; background: none;
  color: rgba(247,239,221,.55);
  font-size: 26px; line-height: 1;
  padding: 4px 8px;
}
.sheet-card input, .sheet-card textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(6, 10, 26, 0.7);
  color: var(--ink);
  padding: 13px 14px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  resize: none;
  margin-bottom: 12px;
}
.sheet-card input:focus, .sheet-card textarea:focus { border-color: rgba(255, 226, 160, .7); }
.sheet-card input::placeholder, .sheet-card textarea::placeholder { color: rgba(247,239,221,.32); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#counter { font-size: 12px; color: rgba(247,239,221,.42); }
.row .primary { padding: 12px 24px; font-size: 14px; }
.err { margin: 12px 0 0; font-size: 12px; color: #ffb0a0; }

.admin-line { display: flex; gap: 10px; margin-bottom: 14px; }
.admin-line input { margin: 0; flex: 1; }
.admin-list { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.admin-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(255, 214, 140, .1);
  font-size: 13px;
}
.admin-item .txt { flex: 1; color: var(--ink); word-break: break-all; }
.admin-item .meta { display: block; margin-top: 4px; font-size: 11px; color: rgba(247,239,221,.38); }
.admin-item button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--gold-dim);
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 11px;
  white-space: nowrap;
}
.admin-item button.warn { color: #ff9d8c; border-color: rgba(255, 140, 120, .3); }
.admin-empty { padding: 20px 0; text-align: center; font-size: 12px; color: rgba(247,239,221,.4); }

/* ---------- Toast ---------- */
#toast {
  position: fixed;
  left: 50%; bottom: calc(96px + var(--safe-bottom));
  transform: translate(-50%, 12px);
  z-index: 10;
  padding: 11px 22px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(12, 18, 40, .92);
  color: var(--gold-bright);
  font-size: 13px;
  letter-spacing: .06em;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s, transform .3s;
  white-space: nowrap;
  max-width: 88vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-height: 600px) {
  .hint { display: none; }
  #danmaku { top: 64%; }
  .toolbar { bottom: calc(12px + var(--safe-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  .sheet, .sheet-card, .dm.is-new { animation: none; }
}
