:root{
  --bg1:#0b1b55;
  --bg2:#09133c;
  --card:rgba(255,255,255,.06);
  --card2:rgba(255,255,255,.09);
  --text:rgba(255,255,255,.92);
  --muted:rgba(255,255,255,.72);
  --line:rgba(255,255,255,.12);
  --shadow:0 18px 60px rgba(0,0,0,.35);
  --primary:#ef4444;
  --primary2:#dc2626;
  --warn:#fbbf24;
  --radius:18px;
  --font:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,"PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;
  --dock-h: 96px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:var(--font);
  color:var(--text);
  overflow-x:hidden;
  overflow-y:auto;
  -webkit-overflow-scrolling: touch;
  background:
    radial-gradient(1200px 700px at 25% 10%, rgba(73,150,255,.18), transparent 60%),
    radial-gradient(900px 600px at 70% 30%, rgba(239,68,68,.15), transparent 55%),
    var(--bg1);
}

#stars{
  position:fixed; inset:0;
  pointer-events:none;
  background:
    radial-gradient(circle at 10% 20%, rgba(255,255,255,.55) 0 1px, transparent 2px),
    radial-gradient(circle at 25% 75%, rgba(255,255,255,.45) 0 1px, transparent 2px),
    radial-gradient(circle at 40% 35%, rgba(255,255,255,.5) 0 1px, transparent 2px),
    radial-gradient(circle at 65% 55%, rgba(255,255,255,.42) 0 1px, transparent 2px),
    radial-gradient(circle at 85% 18%, rgba(255,255,255,.45) 0 1px, transparent 2px);
  opacity:.55;
}

#snow{
  position:fixed; inset:0;
  width:100%; height:100%;
  pointer-events:none;
}

#fx{
  position:fixed; inset:0;
  width:100%; height:100%;
  pointer-events:none;
  z-index:5;
  mix-blend-mode: screen;
}

.topbar{position:fixed; inset:0 0 auto 0; height:0; z-index:30}

.brand{
  position:fixed;
  top:12px;
  left:50%;
  transform:translateX(-50%);
  padding:10px 14px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.05);
  border-radius:999px;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 40px rgba(0,0,0,.18);
  text-align:center;
}
.brand__title{
  display:flex;
  align-items:baseline;
  justify-content:center;
  gap:8px;
  font-size:26px;
  font-weight:900;
  letter-spacing:.5px;
  line-height:1.05;
  color:#ffd166;
  text-shadow:0 10px 45px rgba(0,0,0,.35);
}
.brand__year{
  font-size:18px;
  font-weight:1000;
  color:rgba(255,255,255,.86);
  text-shadow:none;
}
.brand__sub{font-size:12px;color:var(--muted);margin-top:2px}
.brand__countdown{
  font-size:12px;
  color:rgba(255,255,255,.78);
  margin-top:4px;
}

.actions{
  position:fixed;
  left:50%;
  bottom:calc(14px + env(safe-area-inset-bottom));
  transform:translateX(-50%);
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:center;
  flex-wrap:wrap;
  max-width:calc(100vw - 32px);
  padding:10px 12px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.05);
  backdrop-filter: blur(12px);
  box-shadow: 0 16px 60px rgba(0,0,0,.25);
}
.btn--toggle{min-width:auto}
.btn--toggle::before{
  content:"";
  width:8px;
  height:8px;
  border-radius:999px;
  display:inline-block;
  margin-right:8px;
  background:rgba(255,255,255,.28);
  box-shadow:0 0 0 1px rgba(0,0,0,.18) inset;
}
.btn--toggle[aria-pressed="true"]::before{
  background:linear-gradient(180deg,var(--primary),var(--primary2));
  box-shadow:0 0 18px rgba(34,197,94,.35);
}
.btn--toggle.is-off{opacity:.82}
.btn{
  border:1px solid var(--line);
  background:rgba(255,255,255,.06);
  color:var(--text);
  padding:10px 14px;
  border-radius:999px;
  cursor:pointer;
  backdrop-filter: blur(10px);
  transition:transform .12s ease, background .12s ease, border-color .12s ease;
  user-select:none;
  font-weight:700;
}
.btn:hover{transform:translateY(-1px); background:rgba(255,255,255,.1); border-color:rgba(255,255,255,.2)}
.btn:active{transform:translateY(0px)}
.btn--primary{
  background:linear-gradient(180deg,var(--primary),var(--primary2));
  border-color:rgba(34,197,94,.35);
}
.btn--primary:hover{background:linear-gradient(180deg,#f87171,#dc2626)}
.btn--ghost{background:rgba(255,255,255,.05)}

.stage{
  position:relative;
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:92px 16px calc(var(--dock-h) + 24px + env(safe-area-inset-bottom));
}

.hero{
  width:min(980px, 96vw);
  min-height:calc(100vh - 120px);
  display:grid;
  grid-template-rows:1fr auto;
  align-items:center;
  justify-items:center;
  padding-bottom: calc(var(--dock-h) + 10px);
  padding-top: 18px;
}

.lantern-wrap{
  position:relative;
  width:min(300px, 78vw);
  margin-top:clamp(-84px, -8vh, -28px);
  filter: drop-shadow(0 18px 40px rgba(0,0,0,.45));
  cursor:pointer;
  touch-action:manipulation;
  outline:none;
}
.lantern-wrap:focus-visible{
  box-shadow: 0 0 0 3px rgba(255, 209, 102, .24);
  border-radius:22px;
}
.lantern{width:100%; height:auto}
.ball{
  opacity:.9;
  transform-box: fill-box;
  transform-origin:center;
  animation:twinkle var(--twinkle-dur, 1.8s) ease-in-out infinite;
  filter:
    drop-shadow(0 0 2px rgba(255,255,255,.35))
    drop-shadow(0 0 10px var(--glow, rgba(167,243,208,.85)));
}
.ball--r{fill:#fb7185; --glow:rgba(251,113,133,.95)}
.ball--y{fill:#fbbf24; --glow:rgba(251,191,36,.95)}
.ball--b{fill:#60a5fa; --glow:rgba(96,165,250,.95)}
.ball--p{fill:#c4b5fd; --glow:rgba(196,181,253,.95)}
.ball--c{fill:#34d399; --glow:rgba(52,211,153,.95)}

.lantern .ball:nth-of-type(1){--twinkle-dur:1.35s; animation-delay:-.2s}
.lantern .ball:nth-of-type(2){--twinkle-dur:1.55s; animation-delay:-.75s}
.lantern .ball:nth-of-type(3){--twinkle-dur:1.75s; animation-delay:-.35s}
.lantern .ball:nth-of-type(4){--twinkle-dur:1.95s; animation-delay:-1.05s}
.lantern .ball:nth-of-type(5){--twinkle-dur:1.6s; animation-delay:-.55s}

@keyframes twinkle{
  0%,100%{opacity:.68; transform:scale(.94); filter:drop-shadow(0 0 1px rgba(255,255,255,.2)) drop-shadow(0 0 7px var(--glow, rgba(255,255,255,.6)))}
  50%{opacity:1; transform:scale(1.08); filter:drop-shadow(0 0 3px rgba(255,255,255,.6)) drop-shadow(0 0 16px var(--glow, rgba(255,255,255,.85)))}
}

@media (prefers-reduced-motion: reduce){
  .ball{animation:none}
}

.lantern-wrap.is-pop{
  animation:lantern-pop .52s cubic-bezier(.2,.8,.2,1);
}
.lantern-wrap.is-pop .ball{
  filter:
    drop-shadow(0 0 4px rgba(255,255,255,.55))
    drop-shadow(0 0 22px var(--glow, rgba(255,255,255,.9)));
}
@keyframes lantern-pop{
  0%{transform:translateY(0) scale(1) rotate(0deg)}
  25%{transform:translateY(-8px) scale(1.04) rotate(-1.2deg)}
  55%{transform:translateY(2px) scale(1.02) rotate(1deg)}
  100%{transform:translateY(0) scale(1) rotate(0deg)}
}

.sparkle{
  position:absolute;
  left:0; top:0;
  width:10px;
  height:10px;
  border-radius:999px;
  pointer-events:none;
  background: radial-gradient(circle at 35% 35%, rgba(255,255,255,.95), rgba(255,255,255,.25) 55%, transparent 70%);
  filter:
    drop-shadow(0 0 2px rgba(255,255,255,.5))
    drop-shadow(0 0 14px rgba(255, 209, 102, .55));
  transform:translate(-50%,-50%) scale(.6);
  opacity:.95;
  animation:sparkle-fly .72s ease-out forwards;
}
@keyframes sparkle-fly{
  0%{transform:translate(-50%,-50%) scale(.6); opacity:.95}
  100%{transform:translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, -40px))) scale(1.15); opacity:0}
}

.hint{
  width:min(720px, 96vw);
  text-align:center;
  padding:14px 16px 6px;
}
.hint__title{font-weight:900;font-size:22px}
.hint__sub{color:var(--muted); font-size:13px; margin-top:6px}

.danmaku{
  position:absolute;
  inset:0;
  pointer-events:none;
  overflow:hidden;
  z-index:20;
}

.dm{
  position:absolute;
  left:100%;
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:7px 12px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.16);
  background:rgba(0,0,0,.18);
  backdrop-filter: blur(10px);
  box-shadow:0 14px 40px rgba(0,0,0,.22);
  white-space:nowrap;
  font-weight:800;
  transform:translateZ(0);
}
.dm__emoji{filter: drop-shadow(0 6px 16px rgba(0,0,0,.25))}
.dm__name{color:rgba(255,255,255,.85)}
.dm__msg{color:rgba(255,255,255,.95)}

.hidden{display:none !important}

.square{
  width:min(980px, 96vw);
  max-height:calc(100vh - 120px - var(--dock-h));
  overflow:auto;
  padding:16px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.04);
  border-radius:var(--radius);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}
.square::-webkit-scrollbar{height:10px;width:10px}
.square::-webkit-scrollbar-thumb{background:rgba(255,255,255,.12); border-radius:999px}
.square__head{display:flex; align-items:flex-end; justify-content:space-between; gap:12px; padding-bottom:12px; border-bottom:1px solid var(--line)}
.square__title{font-size:22px;font-weight:900}
.square__sub{color:var(--muted); font-size:12px; margin-top:4px}
.square__tools{display:flex; gap:10px}
.square__meta{color:var(--muted); font-size:12px; padding:10px 2px}
.square__list{
  display:grid;
  grid-template-columns:repeat(2, minmax(0,1fr));
  gap:12px;
}
@media (max-width:760px){
  :root{--dock-h: 120px;}
  .hero{
    grid-template-rows:auto auto;
    align-content:start;
    row-gap:6px;
  }
  .brand{
    top:10px;
    width:min(420px, calc(100vw - 24px));
    max-width:calc(100vw - 24px);
    padding:10px 12px;
  }
  .brand__title{font-size:22px}
  .brand__sub{font-size:11px}

  .actions{
    flex-direction:row;
    flex-wrap:nowrap;
    overflow-x:auto;
    overflow-y:hidden;
    align-items:center;
    justify-content:flex-start;
    gap:8px;
    padding:10px 10px;
    border-radius:22px;
    background:rgba(9,19,60,.38);
    box-shadow: 0 14px 46px rgba(0,0,0,.22);
    scrollbar-width:none;
  }
  .actions::-webkit-scrollbar{display:none}

  .actions .btn{
    flex: 0 0 auto;
    white-space: nowrap;
    writing-mode: vertical-rl;
    text-orientation: upright;
    padding:10px 8px;
    min-height:78px;
    min-width:46px;
    line-height:1.05;
    justify-content:center;
  }
  .actions .btn--primary{min-width:52px}
  .actions .btn--toggle::before{
    display:block;
    margin-right:0;
    margin-bottom:8px;
    margin-top:2px;
  }
  .btn{font-size:13px}
  .btn--toggle{min-width:auto}

  .lantern-wrap{
    width:min(280px, 78vw);
    margin-top:clamp(-58px, -6vh, -14px);
  }
  .hint{padding:6px 16px 0}
  .square__list{grid-template-columns:1fr}
}
.card{
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.05);
  border-radius:16px;
  padding:12px 12px 10px;
}
.card__top{display:flex; align-items:center; justify-content:space-between; gap:12px}
.card__name{font-weight:900}
.card__time{color:var(--muted); font-size:12px}
.card__msg{margin-top:10px; line-height:1.35; font-size:14px; white-space:pre-wrap; word-break:break-word}
.card__emoji{opacity:.9}
.square__more{display:flex; justify-content:center; padding-top:14px}
.empty{
  grid-column: 1 / -1;
  text-align:center;
  padding:26px 10px;
  color:var(--muted);
  border:1px dashed rgba(255,255,255,.18);
  border-radius:16px;
  background:rgba(255,255,255,.03);
}

.gift{
  width:min(980px, 96vw);
  max-height:calc(100vh - 120px - var(--dock-h));
  overflow:auto;
  padding:18px 16px 16px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.04);
  border-radius:var(--radius);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}
.gift::-webkit-scrollbar{height:10px;width:10px}
.gift::-webkit-scrollbar-thumb{background:rgba(255,255,255,.12); border-radius:999px}
.gift__head{padding-bottom:12px; border-bottom:1px solid var(--line)}
.gift__title{font-size:22px;font-weight:900}
.gift__sub{color:var(--muted); font-size:12px; margin-top:6px}
.gift__body{
  display:grid;
  grid-template-columns: 280px 1fr;
  gap:14px;
  align-items:center;
  padding:16px 0 10px;
}
@media (max-width:820px){
  .gift__body{grid-template-columns:1fr}
}
.gift__actions{display:flex; gap:10px; justify-content:flex-end; padding-top:10px; border-top:1px solid var(--line)}

.giftbox{
  position:relative;
  width:260px;
  height:220px;
  border:none;
  background:transparent;
  cursor:pointer;
  margin: 8px auto;
  filter: drop-shadow(0 18px 38px rgba(0,0,0,.38));
  transform: translateZ(0);
}
.giftbox:focus-visible{outline: 2px solid rgba(255,255,255,.35); outline-offset: 6px; border-radius:18px}
.giftbox__box{
  position:absolute;
  left:22px; right:22px;
  bottom:18px;
  height:150px;
  border-radius:18px;
  background:linear-gradient(180deg, rgba(255,255,255,.14), rgba(255,255,255,.06));
  border:1px solid rgba(255,255,255,.18);
  backdrop-filter: blur(10px);
}
.giftbox__lid{
  position:absolute;
  left:10px; right:10px;
  top:24px;
  height:64px;
  border-radius:18px;
  background:linear-gradient(180deg, rgba(255,255,255,.18), rgba(255,255,255,.08));
  border:1px solid rgba(255,255,255,.2);
  transform-origin: 22px 64px;
  transition: transform .55s cubic-bezier(.2,.9,.2,1), top .55s cubic-bezier(.2,.9,.2,1);
}
.giftbox__ribbon{
  position:absolute;
  left:50%;
  top:26px;
  bottom:20px;
  width:18px;
  transform:translateX(-50%);
  border-radius:999px;
  background:linear-gradient(180deg,#ffd166,#fbbf24);
  box-shadow: 0 16px 44px rgba(251,191,36,.18);
}
.giftbox__ribbon::before,
.giftbox__ribbon::after{
  content:"";
  position:absolute;
  top:-10px;
  width:60px;
  height:40px;
  border-radius:30px 30px 10px 10px;
  background:linear-gradient(180deg,#ffd166,#fbbf24);
}
.giftbox__ribbon::before{left:-60px; transform: rotate(-12deg)}
.giftbox__ribbon::after{right:-60px; transform: rotate(12deg)}

.giftbox--open .giftbox__lid{
  transform: rotate(-22deg) translateY(-12px);
  top:8px;
}

.giftcards{
  display:grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap:12px;
}
@media (max-width:820px){
  .giftcards{grid-template-columns:1fr}
}
.giftcard{
  border:1px solid rgba(255,255,255,.14);
  background:linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,.05));
  border-radius:18px;
  padding:12px;
  min-height:132px;
  position:relative;
  overflow:hidden;
  transform: translateY(8px);
  opacity:0;
  animation: gift-in .55s ease forwards;
}
.giftcard:nth-child(2){animation-delay:.08s}
.giftcard:nth-child(3){animation-delay:.16s}
.giftcard::before{
  content:"";
  position:absolute;
  inset:-60px -60px auto auto;
  width:140px; height:140px;
  background: radial-gradient(circle at 30% 30%, rgba(255,209,102,.22), transparent 60%);
  transform: rotate(22deg);
}
.giftcard__top{display:flex; align-items:center; justify-content:space-between; gap:10px}
.giftcard__name{font-weight:1000}
.giftcard__emoji{opacity:.95}
.giftcard__msg{margin-top:10px; line-height:1.35; font-size:14px; white-space:pre-wrap; word-break:break-word}
.giftcard__from{margin-top:10px; color:var(--muted); font-size:12px}
.giftcards--hint{
  color:var(--muted);
  font-size:12px;
  align-content:center;
}
@keyframes gift-in{
  from{transform:translateY(10px) scale(.98); opacity:0}
  to{transform:translateY(0) scale(1); opacity:1}
}

.modal{
  position:fixed; inset:0;
  z-index:50;
}
.modal__mask{
  position:absolute; inset:0;
  background:rgba(0,0,0,.5);
}
.modal__panel{
  position:absolute;
  left:50%; top:50%;
  transform:translate(-50%,-50%);
  width:min(520px, 92vw);
  border:1px solid rgba(255, 209, 102, .28);
  background:
    radial-gradient(900px 320px at 18% 0%, rgba(255, 209, 102, .28), transparent 62%),
    radial-gradient(820px 300px at 98% 0%, rgba(34, 197, 94, .22), transparent 66%),
    linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,.06)),
    rgba(14, 22, 62, .58);
  border-radius:22px;
  padding:16px;
  box-shadow:
    0 18px 70px rgba(0,0,0,.42),
    0 0 0 1px rgba(255,255,255,.06) inset;
  backdrop-filter: blur(16px);
}
.modal__title{font-weight:1000; font-size:18px; margin-bottom:12px; color:#ffd166; text-shadow:0 14px 40px rgba(0,0,0,.28)}

.form{display:grid; gap:12px}
.field{display:grid; gap:8px}
.field__label{font-size:12px; color:var(--muted); font-weight:800}
.field--small{max-width:240px}
.input{
  width:100%;
  color:var(--text);
  background:rgba(255,255,255,.10);
  border:1px solid rgba(255,255,255,.14);
  border-radius:14px;
  padding:10px 12px;
  outline:none;
}
.input:focus{border-color:rgba(255,255,255,.28)}
.input--textarea{min-height:96px; resize:none}
.form__row{display:flex; align-items:flex-end; justify-content:space-between; gap:12px}
.counter{color:var(--muted); font-size:12px}
.form__actions{display:flex; justify-content:flex-end; gap:10px; padding-top:6px}
.toast{min-height:18px; color:rgba(255,255,255,.88); font-size:12px}

.modal__panel--welcome{
  width:min(560px, 92vw);
  background:
    radial-gradient(900px 320px at 18% 0%, rgba(255, 209, 102, .34), transparent 60%),
    radial-gradient(820px 300px at 98% 0%, rgba(34, 197, 94, .26), transparent 66%),
    linear-gradient(180deg, rgba(255,255,255,.18), rgba(255,255,255,.07)),
    rgba(14, 22, 62, .54);
  border-color: rgba(255, 209, 102, .22);
  box-shadow:
    0 18px 70px rgba(0,0,0,.45),
    0 0 0 1px rgba(255,255,255,.06) inset;
}
.modal__panel--welcome .modal__title{color:#ffd166; text-shadow:0 14px 40px rgba(0,0,0,.35)}
.welcome__text{
  color:rgba(255,255,255,.96);
  line-height:1.5;
  font-weight:800;
  font-size:14px;
  padding:8px 2px 2px;
}
