:root {
  --red: #BD2D26; --red-dark: #8E1E1B; --red-tint: #FCE8E6; --red-soft: #F2A9A4;
  --ink: #1E1E1E; --muted: #5C5C5C; --line: #E6E6E6; --ground: #F6F6F6; --card: #FFFFFF;
  --photo: #ECE6E0; --green: #2D6A3E; --amber: #8A5A00;
  --nav-h: 76px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--ground); color: var(--ink); font-family: 'Nunito', system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--red); }
button, input, textarea, select { font-family: inherit; font-size: 16px; color: var(--ink); }
img, video { max-width: 100%; display: block; }
.loading { padding: 40vh 24px; text-align: center; font-weight: 800; color: var(--muted); }

.screen { max-width: 560px; margin: 0 auto; padding: 16px 20px calc(var(--nav-h) + 32px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; }
.screen.no-nav { padding-bottom: 40px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand img { width: 50px; height: 44px; object-fit: contain; }
.brand small { display: block; font-size: 13px; font-weight: 700; color: var(--muted); }
.brand strong { display: block; font-size: 19px; font-weight: 900; line-height: 1.15; }
.icon-btn { width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--line); background: var(--card); display: inline-flex; align-items: center; justify-content: center; position: relative; color: var(--ink); cursor: pointer; text-decoration: none; flex-shrink: 0; padding: 0; }
.badge { position: absolute; top: 6px; right: 6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 900; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; }

h1, h2, h3 { margin: 0; font-weight: 900; }
h1 { font-size: 30px; line-height: 1.1; color: var(--red); }
h2 { font-size: 18px; }
p { margin: 0; line-height: 1.5; }
.muted { color: var(--muted); font-weight: 600; }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 10px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.card.red { background: var(--red); border-color: var(--red); color: #fff; }
.card.red .muted { color: #FDECEB; }
.card.tint { background: var(--red-tint); border-color: var(--red-tint); }

.hero { position: relative; aspect-ratio: 1 / 0.86; border-radius: 28px; overflow: hidden; background: var(--photo); display: flex; align-items: center; justify-content: center; color: #5E5650; }
.hero img, .hero video { width: 100%; height: 100%; object-fit: cover; }
.chip-on-photo { position: absolute; left: 14px; bottom: 14px; background: rgba(20,20,20,.82); color: #fff; padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 800; }
.pill { display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 900; background: var(--red-tint); color: var(--red-dark); white-space: nowrap; }
.pill.dark { background: var(--ink); color: #fff; }
.pill.green { background: #E3F1E6; color: var(--green); }
.pill.amber { background: #FFF2D6; color: var(--amber); }

.segments { display: flex; gap: 6px; }
.segments span { flex: 1; height: 8px; border-radius: 4px; background: var(--line); }
.segments .done { background: var(--red); }
.segments .now { background: var(--red-soft); }
.bar { height: 10px; border-radius: 5px; background: var(--line); overflow: hidden; }
.bar > div { height: 100%; background: var(--red); border-radius: 5px; }
.card.red .bar { background: rgba(255,255,255,.25); }
.card.red .bar > div { background: #fff; }

.feed-item { display: flex; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 10px; text-decoration: none; color: var(--ink); }
.thumb { width: 64px; height: 64px; border-radius: 14px; background: var(--photo); flex-shrink: 0; overflow: hidden; position: relative; display: flex; align-items: center; justify-content: center; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-icon { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--red-tint); color: var(--red); }
.icon-banner { border-radius: 24px; background: var(--red-tint); color: var(--red); display: flex; align-items: center; justify-content: center; height: 170px; }
.play { width: 28px; height: 28px; border-radius: 14px; background: rgba(20,20,20,.82); display: flex; align-items: center; justify-content: center; position: absolute; }
.feed-item b { display: block; font-size: 15px; font-weight: 800; }
.grow { flex: 1; min-width: 0; }

.btn { min-height: 50px; padding: 0 20px; border-radius: 25px; border: 0; background: var(--red); color: #fff; font-size: 16px; font-weight: 900; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--red-dark); }
.btn.white { background: #fff; color: var(--red); }
.btn.ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.btn.dark { background: var(--ink); }
.btn.small { min-height: 44px; font-size: 14px; padding: 0 16px; }
.btn[disabled] { opacity: .6; cursor: default; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 40px; padding: 8px 14px; border-radius: 999px; border: 1px solid #D6D6D6; background: var(--card); font-size: 14px; font-weight: 800; cursor: pointer; text-decoration: none; color: var(--ink); display: inline-flex; align-items: center; }
.chip[aria-pressed="true"] { background: var(--red); border-color: var(--red); color: #fff; }

label { font-size: 13px; font-weight: 800; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 6px; }
input[type=text], input[type=email], input[type=date], input[type=number], textarea, select {
  min-height: 50px; border-radius: 16px; border: 1px solid #D6D6D6; background: var(--card); padding: 12px 16px; font-weight: 600; width: 100%; }
textarea { resize: vertical; line-height: 1.45; }
input:focus, textarea:focus, select:focus, .btn:focus-visible, .chip:focus-visible, a:focus-visible { outline: 3px solid var(--red-soft); outline-offset: 2px; }

.media-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.media-grid > * { aspect-ratio: 1; border-radius: 14px; background: var(--photo); overflow: hidden; position: relative; }
.media-grid img, .media-grid video { width: 100%; height: 100%; object-fit: cover; }
.add-media { border: 2px dashed #BDBDBD !important; background: #fff !important; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--red); font-weight: 800; font-size: 13px; cursor: pointer; }
.remove { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border-radius: 15px; border: 0; background: rgba(20,20,20,.82); color: #fff; cursor: pointer; }

.carousel { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 10px; border-radius: 24px; }
.carousel > * { flex: 0 0 100%; scroll-snap-align: start; border-radius: 24px; overflow: hidden; background: var(--photo); aspect-ratio: 1 / 1; }
.carousel img, .carousel video { width: 100%; height: 100%; object-fit: cover; background: #111; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 14px; }
.timeline .rail { display: flex; flex-direction: column; align-items: center; width: 32px; flex-shrink: 0; }
.timeline .dot { width: 32px; height: 32px; border-radius: 16px; border: 3px solid #D6D6D6; background: #fff; display: flex; align-items: center; justify-content: center; }
.timeline .dot.done { background: var(--red); border-color: var(--red); }
.timeline .dot.now { background: var(--red); border: 5px solid var(--red-tint); }
.timeline .line { width: 3px; flex: 1; min-height: 20px; background: #D6D6D6; }
.timeline .line.done { background: var(--red); }
.timeline .content { padding-bottom: 20px; display: flex; flex-direction: column; gap: 3px; flex: 1; }

.notice { display: flex; gap: 10px; align-items: flex-start; background: var(--red-tint); border-radius: 16px; padding: 12px 14px; font-size: 14px; font-weight: 700; line-height: 1.4; }
.notice svg { flex-shrink: 0; color: var(--red); }

.tabs { display: flex; gap: 6px; background: #EAEAEA; padding: 4px; border-radius: 999px; }
.tabs a { flex: 1; text-align: center; padding: 10px 8px; border-radius: 999px; text-decoration: none; font-weight: 800; font-size: 14px; color: var(--ink); }
.tabs a[aria-current="page"] { background: #fff; color: var(--red); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.list-row { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.list-row:first-child { border-top: 0; }

.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
.bottom-nav .inner { display: flex; justify-content: space-around; width: 100%; max-width: 560px; height: var(--nav-h); align-items: center; }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 72px; min-height: 48px; justify-content: center; text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 800; position: relative; }
.bottom-nav a[aria-current="page"] { color: var(--red); font-weight: 900; }
.bottom-nav .fab { width: 56px; height: 56px; min-width: 56px; border-radius: 28px; background: var(--red); color: #fff; }

.birthday { background: var(--red); color: #fff; border-radius: 28px; padding: 22px; display: flex; flex-direction: column; gap: 12px; position: relative; overflow: hidden; }
.birthday h2 { font-size: 30px; line-height: 1.05; }
.confetti span { position: absolute; border-radius: 3px; background: var(--red-soft); }

.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login .card { width: 100%; max-width: 420px; padding: 28px 24px; gap: 16px; }
.login img { width: 120px; margin: 0 auto; }

/* celebrations */
.fx-layer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 50; }
.fx-confetti { position: absolute; top: -20px; display: block; border-radius: 2px; animation: fx-fall linear forwards; opacity: 0; }
@keyframes fx-fall { 0% { opacity: 1; transform: translate(0, 0) rotate(0); } 85% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--drift), 105vh) rotate(var(--spin)); } }
.fx-paw { position: absolute; width: 42px; height: 42px; color: var(--red); opacity: 0; animation: fx-paw 3.2s ease-out forwards; }
.fx-paw svg, .fx-heart svg, .fx-pop svg { width: 100%; height: 100%; display: block; }
@keyframes fx-paw { 0% { opacity: 0; scale: .4; } 12% { opacity: .9; scale: 1; } 70% { opacity: .9; } 100% { opacity: 0; } }
.fx-heart { position: absolute; bottom: -40px; display: block; animation: fx-rise ease-out forwards; opacity: 0; }
@keyframes fx-rise { 0% { opacity: 0; transform: translate(0, 0) scale(.6); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--drift), -85vh) scale(1.1); } }
.fx-pop { position: absolute; width: 20px; height: 20px; color: var(--red); animation: fx-pop .9s ease-out forwards; }
@keyframes fx-pop { 0% { opacity: 1; transform: translate(0, 0) scale(.5); } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1.2); } }
.celebrate-hero { position: relative; border-radius: 24px; overflow: hidden; aspect-ratio: 1 / 1; background: var(--photo); }
.celebrate-hero img { width: 100%; height: 100%; object-fit: cover; }
.celebrate-hero .ribbon { position: absolute; left: 14px; bottom: 14px; right: 14px; display: flex; align-items: center; gap: 10px; background: var(--red); color: #fff; padding: 12px 14px; border-radius: 16px; font-weight: 900; font-size: 16px; }
.offer { border: 2px solid var(--red); }
.offer .photo { aspect-ratio: 4 / 3; border-radius: 16px; overflow: hidden; background: var(--red-tint); display: flex; align-items: center; justify-content: center; color: var(--red); }
.offer .photo img { width: 100%; height: 100%; object-fit: cover; }

#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 800; font-size: 14px; opacity: 0; pointer-events: none; transition: all .2s; z-index: 20; max-width: calc(100% - 40px); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); font-weight: 700; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
