:root {
  --bg: #0b0b0d;
  --surface: #141417;
  --surface-2: #1c1c20;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f5f5f7;
  --muted: #8e8e93;
  --faint: #5a5a60;
  --rose: #e9b9a6;
  --rose-deep: #c98b78;
  --rose-grad: linear-gradient(135deg, #f6d3c4 0%, #d9a08c 55%, #b9786a 100%);
  --green: #7fd1a6;
  --amber: #f0c674;
  --danger: #ff8a80;
  --radius: 20px;
  --tabs-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --serif: Didot, "Bodoni 72", "Bodoni MT", Georgia, serif;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang TC", "Noto Sans TC", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; opacity: 0.4; }
:focus-visible { outline: 2px solid var(--rose); outline-offset: 2px; border-radius: 8px; }
.num { font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
[hidden] { display: none !important; }

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: max(env(safe-area-inset-top), 16px) 16px calc(var(--tabs-h) + var(--safe-b) + 24px);
}

/* ---------- boot / locked ---------- */
.boot { min-height: 80dvh; display: grid; place-items: center; }
.boot-mark {
  font: 72px/1 var(--serif);
  background: var(--rose-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: breathe 1.6s ease-in-out infinite;
}
@keyframes breathe { 50% { opacity: 0.35; } }

.locked { min-height: 86dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 28px; }
.locked h1 { font-size: 22px; font-weight: 600; }
.locked p { color: var(--muted); max-width: 18em; }
.nfc-pulse { position: relative; width: 132px; height: 132px; display: grid; place-items: center; color: var(--rose); }
.nfc-pulse::before, .nfc-pulse::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid var(--rose-deep);
  animation: ripple 2.4s ease-out infinite; opacity: 0;
}
.nfc-pulse::after { animation-delay: 1.2s; }
.nfc-pulse svg { width: 56px; height: 56px; }
@keyframes ripple { 0% { transform: scale(0.5); opacity: 0.9; } 100% { transform: scale(1.25); opacity: 0; } }

/* ---------- header ---------- */
.top { display: flex; align-items: center; justify-content: space-between; padding: 8px 2px 20px; }
.eyebrow { font-size: 11px; letter-spacing: 0.18em; color: var(--muted); text-transform: uppercase; }
.hello { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; }
.hello span { background: var(--rose-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--line); font: 20px/1 var(--serif); color: var(--rose);
}

/* ---------- card ---------- */
.card {
  position: relative; aspect-ratio: 1.586; border-radius: 18px; overflow: hidden; padding: 20px 22px;
  background:
    radial-gradient(120% 140% at 0% 0%, #2c2c33 0%, #131316 45%, #050506 100%);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.09), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  display: grid; grid-template-rows: auto 1fr auto; isolation: isolate;
}
.card::before { /* brushed texture */
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0.35;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,0.025) 0 1px, transparent 1px 3px);
}
.card::after { /* sheen */
  content: ""; position: absolute; inset: -50%; z-index: 1; pointer-events: none;
  background: linear-gradient(115deg, transparent 42%, rgba(255, 255, 255, 0.10) 50%, transparent 58%);
  transform: translateX(-60%); animation: sheen 5s ease-in-out 0.6s infinite;
}
@keyframes sheen { 0%, 60% { transform: translateX(-60%); } 100% { transform: translateX(60%); } }
.card-row { display: flex; justify-content: space-between; align-items: flex-start; }
.card-bank { font-size: 11px; letter-spacing: 0.32em; color: rgba(255, 255, 255, 0.55); font-weight: 500; }
.card-logo {
  font: 46px/0.9 var(--serif);
  background: var(--rose-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.card-mid { display: flex; align-items: center; gap: 14px; }
.chip { width: 42px; height: 32px; }
.contactless { width: 22px; height: 22px; color: rgba(255, 255, 255, 0.5); }
.card-holder { font-size: 14px; letter-spacing: 0.22em; color: rgba(255, 255, 255, 0.82); font-weight: 500; }
.card-since { font-size: 10px; letter-spacing: 0.16em; color: rgba(255, 255, 255, 0.45); text-align: right; line-height: 1.4; }

.tap-pill {
  margin: 14px auto 0; width: fit-content; display: flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: 999px; font-size: 13px;
  background: rgba(127, 209, 166, 0.12); color: var(--green); border: 1px solid rgba(127, 209, 166, 0.25);
}
.tap-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: breathe 1.4s infinite; }

/* ---------- panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-top: 14px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.panel-title { font-size: 13px; color: var(--muted); letter-spacing: 0.04em; }
.link { font-size: 13px; color: var(--rose); }

.balance-row { display: flex; align-items: baseline; gap: 8px; }
.balance-cur { font-size: 15px; color: var(--muted); }
.balance { font-size: 36px; font-weight: 600; letter-spacing: -0.02em; }
.eye { margin-left: auto; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); }
.eye svg { width: 20px; height: 20px; }
.balance-sub { margin-top: 6px; font-size: 13px; color: var(--muted); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.grid2 .panel { margin: 0; }
.stat-big { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }
.stat-big small { font-size: 14px; font-weight: 400; color: var(--muted); margin-left: 2px; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.rose { color: var(--rose); }

.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.action { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 0 4px; font-size: 12px; color: var(--muted); }
.action i {
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--rose); font-style: normal;
}
.action i svg { width: 22px; height: 22px; }
.action:active i { transform: scale(0.94); }

/* ---------- lists ---------- */
.list { list-style: none; padding: 0; }
.item { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; padding-top: 2px; }
.item-icon {
  flex: none; width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
  background: var(--surface-2); font-size: 20px;
}
.item-main { flex: 1; min-width: 0; }
.item-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-sub { font-size: 12px; color: var(--muted); }
.item-amt { font-weight: 600; text-align: right; white-space: nowrap; }
.pos { color: var(--green); }
.badge { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 999px; margin-left: 6px; vertical-align: 1px; }
.badge.pending { color: var(--amber); background: rgba(240, 198, 116, 0.12); }
.badge.fulfilled { color: var(--green); background: rgba(127, 209, 166, 0.12); }
.empty { color: var(--faint); font-size: 13px; text-align: center; padding: 12px 0; }

.page-title { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; padding: 12px 2px 4px; }
.page-sub { color: var(--muted); font-size: 14px; padding: 0 2px; }

.perk { display: flex; gap: 14px; align-items: center; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-top: 12px; }
.perk .item-icon { width: 52px; height: 52px; font-size: 26px; border-radius: 16px; }
.perk-desc { font-size: 13px; color: var(--muted); margin-top: 2px; }
.perk-meta { font-size: 12px; color: var(--rose); margin-top: 6px; }
.perk-meta .stock { color: var(--muted); margin-left: 8px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 16px; border-radius: 999px; font-size: 14px; font-weight: 600;
  background: var(--rose-grad); color: #1a0f0c; white-space: nowrap;
}
.btn.ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.btn.block { width: 100%; height: 52px; font-size: 16px; border-radius: 16px; }

/* ---------- us ---------- */
.hero-days { text-align: center; padding: 28px 0 10px; }
.hero-days .label { color: var(--muted); font-size: 14px; }
.hero-days .big {
  font-size: 84px; font-weight: 700; letter-spacing: -0.04em; line-height: 1.05;
  background: var(--rose-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-days .since { color: var(--faint); font-size: 13px; margin-top: 4px; }
.countdown { margin-left: auto; text-align: right; flex: none; white-space: nowrap; }
.countdown b { font-size: 22px; font-weight: 600; }
.countdown span { font-size: 12px; color: var(--muted); margin-left: 2px; }
.today { color: var(--rose); font-weight: 600; }

/* ---------- tabs ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  height: calc(var(--tabs-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: flex; justify-content: center;
  background: rgba(11, 11, 13, 0.82); -webkit-backdrop-filter: blur(20px) saturate(1.4); backdrop-filter: blur(20px) saturate(1.4);
  border-top: 1px solid var(--line);
}
.tabs-inner { width: 100%; max-width: 480px; display: grid; grid-template-columns: repeat(4, 1fr); }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; color: var(--faint); }
.tab svg { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--rose); }

/* ---------- sheet ---------- */
.sheet-root { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); animation: fade 0.2s ease; }
.sheet {
  position: relative; width: 100%; max-width: 480px; background: #17171a; border: 1px solid var(--line); border-bottom: 0;
  border-radius: 28px 28px 0 0; padding: 12px 20px calc(24px + var(--safe-b));
  animation: up 0.32s cubic-bezier(0.2, 0.9, 0.3, 1);
  text-align: center;
}
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--faint); margin: 0 auto 18px; opacity: 0.6; }
.sheet h2 { font-size: 20px; font-weight: 600; margin-top: 12px; }
.sheet p { color: var(--muted); margin-top: 6px; }
.sheet .big-icon { font-size: 52px; line-height: 1.2; }
.sheet .rows { text-align: left; margin: 20px 0; background: var(--surface); border-radius: 16px; padding: 4px 16px; border: 1px solid var(--line); }
.sheet .rows div { display: flex; justify-content: space-between; padding: 12px 0; border-top: 1px solid var(--line); }
.sheet .rows div:first-child { border-top: 0; }
.sheet .rows span { color: var(--muted); }
.sheet .stack { display: grid; gap: 10px; margin-top: 20px; }
.check { width: 84px; height: 84px; margin: 8px auto 0; color: var(--green); }
.check circle { stroke-dasharray: 240; stroke-dashoffset: 240; animation: draw 0.6s ease forwards; }
.check path { stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw 0.4s 0.45s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

.phone-tap { position: relative; width: 180px; height: 130px; margin: 6px auto 0; }
.phone-tap .ph {
  position: absolute; left: 50%; top: 0; width: 64px; height: 118px; margin-left: -32px; border-radius: 14px;
  border: 2px solid var(--text); animation: tapdown 2.2s ease-in-out infinite;
}
.phone-tap .cd {
  position: absolute; left: 50%; bottom: 0; width: 120px; height: 34px; margin-left: -60px; border-radius: 6px;
  background: radial-gradient(120% 140% at 0% 0%, #34343b, #0a0a0b); border: 1px solid var(--line);
  display: grid; place-items: center; font: 20px/1 var(--serif); color: var(--rose);
}
@keyframes tapdown { 0%, 100% { transform: translateY(-18px); } 45%, 60% { transform: translateY(-2px); } }

.toast {
  position: fixed; left: 50%; top: max(env(safe-area-inset-top), 12px); transform: translateX(-50%); z-index: 30;
  padding: 10px 18px; border-radius: 999px; background: #232327; border: 1px solid var(--line);
  font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); animation: drop 0.3s ease;
}
@keyframes drop { from { transform: translate(-50%, -150%); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}

.panel.married { display: flex; align-items: center; gap: 14px; }
.panel.married .panel-title { color: var(--text); font-weight: 500; letter-spacing: 0; font-size: 15px; }

/* ---------- forms ---------- */
input, select {
  width: 100%; height: 46px; padding: 0 14px; border-radius: 12px; font: inherit; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--line);
}
input:focus, select:focus { outline: none; border-color: var(--rose-deep); }
.wish-form { display: grid; gap: 10px; margin-top: 18px; text-align: left; }
.wish-form .stack { margin-top: 8px; }

/* ---------- limited / locked perks ---------- */
.perk.limited { border-color: rgba(233, 185, 166, 0.35); background: linear-gradient(135deg, rgba(233, 185, 166, 0.10), var(--surface) 60%); }
.perk.is-locked { border-style: dashed; opacity: 0.75; }
.badge.limited { color: #1a0f0c; background: var(--rose-grad); margin: 0 6px 0 0; }
.badge.declined { color: var(--muted); background: var(--surface-2); }
.wish-panel { margin-top: 20px; }
