:root {
  --bg: #FAF6F1;
  --bg-accent: #F3E9DF;
  --surface: #FFFDF9;
  --surface-soft: #FBF7F2;
  --ink: #2C2220;
  --ink-soft: #6C5D58;
  --ink-muted: #9A8A83;
  --rose: #B87463;
  --rose-deep: #965748;
  --rose-light: #E8CEC3;
  --gold: #C89F6C;
  --gold-soft: #F3E7D3;
  --border: rgba(184, 134, 117, 0.22);
  --shadow: 0 14px 36px -18px rgba(84, 52, 42, 0.18);
  --radius: 22px;
  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body {
  background-image:
    radial-gradient(circle at 18% 0%, rgba(232, 206, 195, 0.45), transparent 46%),
    radial-gradient(circle at 90% 14%, rgba(212, 175, 122, 0.22), transparent 40%);
  background-attachment: fixed;
}

.hidden {
  display: none !important;
}

.confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
}

/* Typography */
.eyebrow {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--rose);
}

.serif-title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 34px;
  line-height: 1.12;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.serif-sub {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 24px;
  line-height: 1.2;
  color: var(--ink);
}

.serif-quote {
  margin: 8px 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 23px;
  line-height: 1.38;
  color: var(--ink);
}

/* Lock Screen */
.lock-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(24px + var(--safe-top)) 24px calc(24px + var(--safe-bottom));
}

.lock-inner {
  width: 100%;
  max-width: 340px;
  text-align: center;
  animation: fadeUp 0.55s ease;
}

.lock-emblem {
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lock-hint {
  margin: 10px 0 24px;
  font-size: 13px;
  color: var(--ink-muted);
  min-height: 18px;
}

.pin-dots {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 10px;
}

.pin-dots.shake {
  animation: shake 0.42s ease;
}

.pin-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1.5px solid var(--rose);
  background: transparent;
  transition: transform 0.18s ease, background 0.18s ease;
}

.pin-dot.filled {
  background: var(--rose);
  transform: scale(1.12);
}

.pin-error {
  margin: 6px 0 22px;
  min-height: 18px;
  font-size: 13px;
  color: #B44B4B;
}

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  max-width: 264px;
  margin: 0 auto;
}

.pin-key {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255, 253, 249, 0.88);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 18px -12px rgba(84, 52, 42, 0.25);
  transition: transform 0.12s ease, background 0.12s ease;
}

.pin-key:active {
  transform: scale(0.93);
  background: var(--rose-light);
}

.pin-back {
  font-family: var(--sans);
  font-size: 20px;
  color: var(--ink-soft);
}

/* App Shell */
.app-shell {
  min-height: 100dvh;
  max-width: 520px;
  margin: 0 auto;
  position: relative;
}

.app-main {
  padding: calc(22px + var(--safe-top)) 18px calc(104px + var(--safe-bottom));
}

.tab-panel {
  display: none;
  animation: fadeUp 0.35s ease;
}

.tab-panel.active {
  display: block;
}

.section-header {
  text-align: center;
  margin: 6px 0 24px;
}

.section-sub {
  margin: 10px auto 0;
  max-width: 340px;
  font-size: 14px;
  color: var(--ink-soft);
}

/* Cards */
.editorial-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

/* Hero Card */
.hero-card {
  background: linear-gradient(165deg, #FFFDF9 0%, #FBF3EB 100%);
  border: 1px solid rgba(196, 139, 123, 0.28);
  border-radius: 26px;
  padding: 30px 24px 26px;
  text-align: center;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}

.hero-card::after {
  content: '';
  position: absolute;
  inset: 9px;
  border-radius: 19px;
  border: 1px solid rgba(200, 159, 108, 0.2);
  pointer-events: none;
}

.hero-ornament {
  font-size: 18px;
  color: var(--gold);
  margin-bottom: 8px;
}

.hero-headline {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 36px;
  line-height: 1.1;
  color: var(--ink);
}

.hero-partner {
  margin: 6px 0 14px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 26px;
  color: var(--rose);
}

.hero-welcome {
  margin: 0 auto;
  max-width: 340px;
  font-size: 14.5px;
  color: var(--ink-soft);
  white-space: pre-line;
}

.days-counter {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}

.days-number {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 600;
  color: var(--rose-deep);
}

.days-label {
  font-size: 12.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* Daily Reason */
.card-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--gold);
}

.text-btn {
  border: none;
  background: none;
  color: var(--rose);
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
}

/* Stats Row */
.stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.stat-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px 14px;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease;
}

.stat-pill:active {
  transform: scale(0.97);
}

.stat-value {
  display: block;
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 600;
  line-height: 1.1;
  color: var(--rose);
}

.stat-name {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink-soft);
}

/* Love Ping Card */
.love-ping-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.love-ping-text p {
  margin: 4px 0 0;
  font-size: 13.5px;
  color: var(--ink-soft);
}

.heart-ping-btn {
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #D9A290, #B26C5B);
  color: #FFFDF9;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 24px -8px rgba(178, 108, 91, 0.55);
  transition: transform 0.18s ease;
}

.heart-ping-btn:active {
  transform: scale(0.9);
}

.heart-ping-btn.sent {
  animation: heartbeat 0.65s ease;
}

.heart-ping-btn.cooldown {
  background: var(--bg-accent);
  color: var(--rose-deep);
  box-shadow: none;
  border: 1px solid var(--border);
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  cursor: default;
}

/* iOS Install Tip */
.ios-tip {
  background: var(--gold-soft);
  border: 1px solid rgba(200, 159, 108, 0.45);
  border-radius: 18px;
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--ink);
}

.ios-tip p {
  margin: 3px 0 0;
  color: var(--ink-soft);
}

.icon-close {
  border: none;
  background: none;
  font-size: 22px;
  line-height: 1;
  color: var(--ink-muted);
  cursor: pointer;
  padding: 0 4px;
}

/* Buttons */
.primary-btn {
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 13px 20px;
  background: linear-gradient(135deg, #C78775, #A46252);
  color: #FFFDF9;
  font-family: var(--sans);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 22px -10px rgba(164, 98, 82, 0.6);
  transition: transform 0.14s ease, opacity 0.14s ease;
}

.primary-btn:active {
  transform: scale(0.98);
}

.secondary-btn {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 18px;
  background: var(--surface-soft);
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

/* Vouchers / Scratch Cards */
.vouchers-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.voucher-card {
  position: relative;
  background: var(--surface);
  border: 1px solid rgba(200, 159, 108, 0.38);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow);
  min-height: 204px;
}

.voucher-card.redeemed {
  border-color: rgba(154, 138, 131, 0.25);
  background: #F7F2EC;
}

.voucher-content {
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 204px;
  justify-content: space-between;
}

.voucher-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.voucher-icon {
  font-size: 28px;
  line-height: 1;
}

.voucher-badge {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: #8E6939;
}

.voucher-badge.done {
  background: rgba(184, 116, 99, 0.15);
  color: var(--rose-deep);
}

.voucher-title {
  margin: 4px 0 0;
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.15;
}

.voucher-subtitle {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--rose);
}

.voucher-desc {
  margin: 4px 0 10px;
  font-size: 13.5px;
  color: var(--ink-soft);
}

.voucher-redeem-info {
  font-size: 12.5px;
  color: var(--ink-muted);
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.scratch-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: pointer;
  z-index: 3;
  transition: opacity 0.55s ease;
}

.scratch-layer.revealed {
  opacity: 0;
  pointer-events: none;
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: 22px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 10px;
  bottom: 10px;
  width: 1.5px;
  background: linear-gradient(180deg, var(--rose-light), var(--gold), var(--rose-light));
}

.memory-item {
  position: relative;
  margin-bottom: 22px;
}

.memory-dot {
  position: absolute;
  left: -21px;
  top: 22px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--rose);
  border: 2.5px solid var(--bg);
  box-shadow: 0 0 0 1px var(--rose-light);
}

.memory-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.memory-photo-wrap {
  width: 100%;
  background: var(--bg-accent);
  overflow: hidden;
  cursor: zoom-in;
}

.memory-photo {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: cover;
}

.memory-body {
  padding: 18px 18px 16px;
}

.memory-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.memory-date {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rose);
}

.memory-fav {
  border: none;
  background: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--ink-muted);
  padding: 2px 4px;
  transition: transform 0.16s ease, color 0.16s ease;
}

.memory-fav.active {
  color: #C75D5D;
  transform: scale(1.15);
}

.memory-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 600;
  line-height: 1.2;
}

.memory-location {
  margin: 4px 0 8px;
  font-size: 12.5px;
  color: var(--ink-muted);
}

.memory-story {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--ink-soft);
  white-space: pre-line;
}

/* Jar Card */
.jar-card {
  text-align: center;
  background: linear-gradient(180deg, #FFFDF9 0%, #FBF4EC 100%);
}

.jar-visual {
  display: inline-block;
  margin-bottom: 6px;
  transition: transform 0.35s ease;
}

.jar-visual.wiggle {
  animation: jarWiggle 0.55s ease;
}

.jar-note-stage {
  margin: 16px 0 18px;
  padding: 18px 16px;
  min-height: 92px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px dashed rgba(184, 116, 99, 0.38);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.jar-note-text {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 21px;
  line-height: 1.35;
  color: var(--ink);
}

.jar-note-counter {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.sub-section-head {
  margin: 26px 0 14px;
  padding-left: 4px;
}

/* Letters / Envelopes */
.letters-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.envelope-card {
  position: relative;
  width: 100%;
  text-align: left;
  background: linear-gradient(160deg, #FFFDF9 0%, #F8EFE6 100%);
  border: 1px solid rgba(184, 134, 117, 0.32);
  border-radius: 20px;
  padding: 20px 20px 18px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.envelope-card:active {
  transform: scale(0.985);
}

.envelope-card.locked {
  opacity: 0.72;
  background: #F4EFE9;
}

.envelope-occasion {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rose);
  margin-bottom: 4px;
}

.envelope-title {
  display: block;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
}

.envelope-status {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-muted);
}

.wax-seal {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #DDA38F, #A86050);
  color: #FFFDF9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.35), 0 6px 14px -6px rgba(130, 68, 55, 0.65);
}

.wax-seal.opened {
  background: var(--gold-soft);
  color: var(--gold);
  box-shadow: none;
  border: 1px solid rgba(200, 159, 108, 0.4);
}

/* Bottom Tab Bar */
.tab-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 520px;
  background: rgba(255, 253, 249, 0.86);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  padding: 8px 8px calc(8px + var(--safe-bottom));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  z-index: 40;
}

.tab-btn {
  border: none;
  background: none;
  color: var(--ink-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 4px;
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.18s ease;
}

.tab-btn.active {
  color: var(--rose-deep);
}

.tab-btn.active svg {
  stroke-width: 2.1;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(44, 34, 32, 0.52);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
}

.modal-sheet {
  position: relative;
  width: 100%;
  max-width: 460px;
  background: var(--surface);
  border-radius: 26px;
  padding: 26px 22px calc(22px + var(--safe-bottom));
  box-shadow: 0 24px 60px rgba(30, 18, 15, 0.28);
  animation: fadeUp 0.25s ease;
}

.letter-paper {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 86dvh;
  overflow-y: auto;
  margin: auto;
  background: #FFFDF9;
  border: 1px solid rgba(200, 159, 108, 0.35);
  border-radius: 24px;
  padding: 34px 26px 30px;
  box-shadow: 0 24px 60px rgba(30, 18, 15, 0.32);
  animation: fadeUp 0.3s ease;
}

.letter-divider {
  text-align: center;
  color: var(--gold);
  margin: 16px 0 20px;
  font-size: 16px;
}

.letter-body {
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.65;
  color: var(--ink);
  white-space: pre-line;
}

.letter-signoff {
  margin: 26px 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 22px;
  color: var(--rose);
  text-align: right;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--ink-soft);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.modal-desc {
  margin: 8px 0 16px;
  font-size: 14px;
  color: var(--ink-soft);
}

.field-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.text-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  background: var(--surface-soft);
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink);
  resize: vertical;
  outline: none;
}

.text-input:focus {
  border-color: var(--rose);
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 10px;
  margin-top: 16px;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(24, 18, 17, 0.94);
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.lightbox img {
  max-width: 100%;
  max-height: 78dvh;
  border-radius: 12px;
  object-fit: contain;
}

.lightbox-caption {
  margin: 14px 0 0;
  color: #F5EBE2;
  font-family: var(--serif);
  font-size: 20px;
  text-align: center;
}

.lightbox-close {
  position: absolute;
  top: calc(16px + var(--safe-top));
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 26px;
  cursor: pointer;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(86px + var(--safe-bottom));
  transform: translateX(-50%);
  background: var(--ink);
  color: #FFFDF9;
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
  z-index: 200;
  white-space: nowrap;
  animation: fadeUp 0.22s ease;
}

.empty-state {
  text-align: center;
  padding: 36px 20px;
  color: var(--ink-muted);
  font-size: 14px;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

@keyframes heartbeat {
  0% { transform: scale(1); }
  25% { transform: scale(1.18); }
  50% { transform: scale(0.96); }
  75% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

@keyframes jarWiggle {
  0%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(-6deg); }
  45% { transform: rotate(5deg); }
  70% { transform: rotate(-3deg); }
}
