:root {
  --bg0: #1a0306; --bg1: #3b070c; --red: #c8161d;
  --gold: #f3c867; --gold2: #fff1c7; --gold3: #b8862b;
  --ink: #fff6e6; --muted: rgba(255, 236, 205, .62);
  --glass: rgba(255, 220, 170, .06); --line: rgba(243, 200, 103, .22);
  --serif: "Noto Serif Display", Georgia, serif;
  --sans: "Be Vietnam Pro", system-ui, sans-serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; min-height: 100dvh; color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(1200px 700px at 50% 38%, rgba(214, 40, 40, .38), transparent 65%),
    radial-gradient(900px 500px at 50% 110%, rgba(243, 200, 103, .14), transparent 70%),
    linear-gradient(180deg, var(--bg1), var(--bg0));
  overflow-x: hidden; display: flex; flex-direction: column;
}
/* hoạ tiết mây cổ rất mờ */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='60' viewBox='0 0 120 60'%3E%3Cpath d='M0 30c10 0 10-12 20-12s10 12 20 12 10-12 20-12 10 12 20 12 10-12 20-12 10 12 20 12' fill='none' stroke='%23f3c867' stroke-width='1.5'/%3E%3Ccircle cx='20' cy='44' r='3' fill='none' stroke='%23f3c867'/%3E%3Ccircle cx='80' cy='44' r='3' fill='none' stroke='%23f3c867'/%3E%3C/svg%3E");
}
canvas { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#fireworks { z-index: 3; }
.glow { position: fixed; left: 50%; top: 42%; width: 70vmin; height: 70vmin; transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(circle, rgba(243, 200, 103, .18), transparent 65%); filter: blur(20px); animation: breathe 6s ease-in-out infinite; pointer-events: none; }
@keyframes breathe { 50% { transform: translate(-50%, -50%) scale(1.12); opacity: .7; } }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* đèn lồng */
.lantern { position: fixed; top: -6px; width: 72px; height: 144px; z-index: 2; transform-origin: 50% 0; animation: sway 5s ease-in-out infinite; filter: drop-shadow(0 10px 30px rgba(255, 70, 50, .45)); }
.lantern.l1 { left: 6vw; }
.lantern.l2 { left: 15vw; width: 54px; height: 108px; animation-delay: -1.7s; animation-duration: 6s; }
.lantern.l3 { right: 8vw; width: 80px; height: 160px; animation-delay: -3s; }
@keyframes sway { 50% { transform: rotate(5deg); } 0%, 100% { transform: rotate(-5deg); } }

.wrap { position: relative; z-index: 4; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: max(28px, env(safe-area-inset-top)) 20px 20px; }

/* công tắc chọn mốc */
.switch { position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 5px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); margin-bottom: clamp(26px, 5vh, 52px); }
.switch button { position: relative; z-index: 1; border: 0; background: none; padding: 10px 20px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--muted); transition: color .3s; }
.switch button[aria-selected="true"] { color: #3a0a06; }
.switch .thumb { position: absolute; top: 5px; bottom: 5px; left: 5px; width: calc(50% - 5px); border-radius: 999px;
  background: linear-gradient(180deg, var(--gold2), var(--gold)); box-shadow: 0 6px 20px rgba(243, 200, 103, .35); transition: transform .45s var(--ease); }
.switch[data-mode="duong"] .thumb { transform: translateX(100%); }

.kicker { margin: 0; font-size: 13px; letter-spacing: .32em; text-transform: uppercase; color: var(--muted); }
.title { margin: 10px 0 8px; font: 700 clamp(40px, 8vw, 92px)/1.05 var(--serif); letter-spacing: -.01em;
  background: linear-gradient(180deg, var(--gold2) 10%, var(--gold) 55%, var(--gold3)); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 24px rgba(243, 200, 103, .25)); }
.date { margin: 0 0 clamp(26px, 5vh, 48px); color: var(--muted); font-size: clamp(14px, 1.6vw, 17px); }
.date b { color: var(--ink); font-weight: 600; }

/* đồng hồ */
.clock { display: flex; gap: clamp(10px, 2vw, 22px); }
.unit { width: clamp(72px, 15vw, 170px); padding: clamp(14px, 2.2vw, 26px) 0 clamp(12px, 1.8vw, 20px); border-radius: clamp(16px, 2vw, 26px);
  background: linear-gradient(180deg, rgba(255, 220, 170, .10), rgba(255, 220, 170, .03)); border: 1px solid var(--line);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 20px 50px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 240, 210, .12); }
.unit span { display: block; margin-top: 8px; font-size: clamp(11px, 1.2vw, 13px); letter-spacing: .24em; text-transform: uppercase; color: var(--muted); }
.num { display: flex; justify-content: center; font: 700 clamp(36px, 7.5vw, 96px)/1 var(--serif); font-variant-numeric: tabular-nums; height: 1em; overflow: hidden; }
.num .d { position: relative; display: inline-block; font-weight: inherit; width: .62em; height: 1em; }
.num .d i { position: absolute; inset: 0; font-style: normal;
  background: linear-gradient(180deg, var(--gold2), var(--gold) 60%, var(--gold3)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.num .d i.old { animation: up-out .5s var(--ease) forwards; }
.num .d i.new { animation: up-in .5s var(--ease) forwards; }
@keyframes up-out { to { transform: translateY(-100%); opacity: 0; } }
@keyframes up-in { from { transform: translateY(100%); opacity: 0; } to { transform: none; opacity: 1; } }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.progress { width: min(560px, 90vw); margin-top: clamp(28px, 5vh, 46px); }
.bar { height: 6px; border-radius: 3px; background: rgba(255, 220, 170, .1); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; border-radius: 3px; background: linear-gradient(90deg, var(--red), var(--gold)); transition: width 1s var(--ease); box-shadow: 0 0 12px rgba(243, 200, 103, .6); }
.progress p { margin: 10px 0 0; font-size: 13px; color: var(--muted); }

.wish { min-height: 1.6em; margin: 22px 0 0; font: italic 500 clamp(17px, 2vw, 22px)/1.4 var(--serif); color: var(--gold2); transition: opacity .6s, transform .6s var(--ease); }
.wish.swap { opacity: 0; transform: translateY(6px); }

.actions { display: flex; gap: 12px; margin-top: clamp(24px, 4vh, 36px); flex-wrap: wrap; justify-content: center; }
.btn { display: inline-flex; align-items: center; gap: 9px; height: 48px; padding: 0 22px; border-radius: 14px; font-weight: 600; font-size: 15px; transition: transform .25s var(--ease), box-shadow .25s; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: scale(.97); }
.btn.gold { border: 0; color: #3a0a06; background: linear-gradient(180deg, var(--gold2), var(--gold)); box-shadow: 0 10px 30px rgba(243, 200, 103, .3); }
.btn.gold:hover { box-shadow: 0 14px 40px rgba(243, 200, 103, .45); }
.btn.ghost { border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(10px); }

/* ngày Tết: đồng hồ nhường chỗ cho lời chúc */
body.celebrate .clock, body.celebrate .progress { display: none; }
body.celebrate .title { font-size: clamp(46px, 10vw, 120px); }
body.celebrate .wish { font-size: clamp(20px, 2.6vw, 30px); }

.foot { position: relative; z-index: 4; text-align: center; padding: 14px 0 max(16px, env(safe-area-inset-bottom)); font-size: 12px; color: var(--muted); }
.foot a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
.toast { position: fixed; left: 50%; bottom: 70px; z-index: 12; transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  padding: 10px 16px; border-radius: 12px; background: var(--gold2); color: #3a0a06; font-weight: 600; font-size: 14px; transition: .3s var(--ease); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.sheet-scrim { position: fixed; inset: 0; z-index: 7; background: rgba(10, 0, 2, .55); backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity .3s var(--ease); }
.sheet { position: fixed; z-index: 8; left: 50%; bottom: 0; width: min(520px, 100%); transform: translate(-50%, 110%); transition: transform .45s var(--ease);
  padding: 22px 22px max(22px, env(safe-area-inset-bottom)); border-radius: 26px 26px 0 0; border: 1px solid var(--line); border-bottom: 0;
  background: linear-gradient(180deg, rgba(70, 12, 16, .96), rgba(36, 5, 8, .98)); box-shadow: 0 -20px 60px rgba(0, 0, 0, .5); }
body.sheet-open .sheet { transform: translate(-50%, 0); }
body.sheet-open .sheet-scrim { opacity: 1; pointer-events: auto; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet h2 { margin: 0; font: 700 22px var(--serif); color: var(--gold2); }
.sheet-x { width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line); background: var(--glass); display: grid; place-items: center; }
.sheet-preview { margin: 10px 0 18px; padding: 12px 14px; border-radius: 14px; background: rgba(255, 220, 170, .06); border: 1px dashed var(--line); color: var(--muted); font-size: 14px; }
.sheet-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 8px; }
.sheet-grid button { display: flex; flex-direction: column; align-items: center; gap: 8px; border: 0; background: none; padding: 6px 0; font-size: 12.5px; color: var(--ink); border-radius: 14px; transition: transform .2s var(--ease); }
.sheet-grid button:hover { transform: translateY(-3px); }
.sheet-grid i { width: 54px; height: 54px; border-radius: 17px; display: grid; place-items: center; color: #fff; box-shadow: 0 8px 20px rgba(0, 0, 0, .3); }
.sheet-grid i svg { width: 24px; height: 24px; }
.sheet-grid .brand { fill: currentColor; stroke: none; }
.zalo { font: 800 14px/1 var(--sans); letter-spacing: -.02em; }
@media (min-width: 561px) { .sheet { bottom: 50%; border-radius: 26px; border-bottom: 1px solid var(--line); transform: translate(-50%, 50%) scale(.96); opacity: 0; pointer-events: none; transition: transform .35s var(--ease), opacity .25s; }
  body.sheet-open .sheet { transform: translate(-50%, 50%); opacity: 1; pointer-events: auto; } }

@media (max-width: 560px) {
  .lantern.l2 { display: none; }
  .lantern.l1 { left: 2vw; width: 52px; height: 104px; }
  .lantern.l3 { right: 2vw; width: 56px; height: 112px; }
  .switch button { padding: 9px 14px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}
