:root {
  --ink-1: #6b332c;
  --ink-2: #7a3b34;
  --ink-3: #5f4038;
  --muted-1: #8a5f52;
  --muted-2: #a5837a;
  --disabled: #c8b4ab;
  --accent-warm-1: #e0693f;
  --accent-warm-2: #d1553a;
  --accent-warm-3: #e98c78;
  --accent-green-1: #3f8f5c;
  --accent-green-2: #8fd6a3;
  --accent-green-bg: rgba(168,230,180,.45);
  --locked-bg: #eadfd9;
  --locked-fg: #a6928a;
  --track: #f0dcd3;
}

html, body { margin: 0; padding: 0; }

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

body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  font-family: 'Nunito', system-ui, sans-serif;
  background: radial-gradient(120% 80% at 50% 0%, #fde3d6 0%, #f9d9dd 45%, #f2e6d8 100%);
  position: relative;
}

input, button, textarea { font-family: inherit; }
button { cursor: pointer; }

#root {
  width: 100%;
  max-width: 430px;
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh; /* dvh accounts for mobile browser chrome; vh above is the fallback */
  background: linear-gradient(180deg, rgba(255,252,250,.55), rgba(255,246,240,.25));
  overflow: hidden;
}

@keyframes floatUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(22px); } to { opacity: 1; transform: none; } }
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(233,140,120,.55), 0 6px 16px rgba(200,120,100,.25); }
  50% { box-shadow: 0 0 0 9px rgba(233,140,120,0), 0 6px 16px rgba(200,120,100,.25); }
}
@keyframes confettiFall {
  0% { transform: translate3d(0,-10vh,0) rotate(0deg); opacity: 1; }
  100% { transform: translate3d(var(--dx,0px),86vh,0) rotate(720deg); opacity: 0; }
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px) scale(.96); } to { opacity: 1; transform: translate(-50%,0) scale(1); } }
@keyframes sheetIn { from { transform: translateY(100%); } to { transform: translateY(0); } }

.page { display: flex; flex-direction: column; gap: 14px; padding: 22px 16px 28px; height: 100%; overflow-y: auto; }

/* Calendar page: hero photo stays put, only the cards below it scroll. */
#calendar-page { animation: floatUp .35s ease both; padding: 0; gap: 0; overflow: hidden; }
.calendar-hero-fixed { flex: 0 0 auto; padding: 22px 16px 0; }
.calendar-scroll { flex: 1 1 auto; overflow-y: auto; padding: 14px 16px 28px; display: flex; flex-direction: column; gap: 14px; }

#day-page { animation: slideIn .3s ease both; }

/* Hero card */
.hero-card {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 14px 34px rgba(186,124,105,.22);
  border: 1px solid rgba(255,255,255,.85);
}
.hero-photo { display: block; width: 100%; height: 240px; object-fit: cover; object-position: 50% 28%; }
.hero-scrim { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255,235,225,0) 35%, rgba(122,59,52,.72) 100%); }
.hero-text { position: absolute; left: 18px; right: 18px; bottom: 14px; display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.hero-title { font-family: 'Cormorant Garamond', serif; font-size: 34px; letter-spacing: .04em; color: #fff6f1; font-weight: 600; line-height: 1; }
.hero-kicker { font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: .16em; color: rgba(255,238,230,.85); margin-top: 6px; }
.hero-daycounter { font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: .14em; color: rgba(255,238,230,.85); }

/* Glass cards */
.glass-card {
  background: rgba(255,255,255,.62);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,.75);
  border-radius: 22px;
  box-shadow: 0 10px 30px rgba(186,124,105,.16);
}
.calendar-card { padding: 18px 16px 20px; }
.calendar-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.calendar-range { font-weight: 800; font-size: 15px; letter-spacing: .04em; color: var(--ink-2); }
.calendar-cta { font-size: 11px; font-weight: 700; letter-spacing: .1em; color: var(--muted-2); }
.weekday-row { display: grid; grid-template-columns: repeat(7,1fr); gap: 6px; margin-bottom: 9px; }
.weekday-row span { text-align: center; font-size: 10px; font-weight: 700; color: #c3a49b; }
.day-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 7px; }

.day-cell {
  aspect-ratio: 1/1;
  border: none;
  padding: 0;
  position: relative;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 13px;
  line-height: 1;
  transition: transform .15s ease;
}
.day-cell:hover { transform: scale(1.08); }
.day-cell.disabled { cursor: default; }
.day-cell.disabled:hover { transform: none; }
.day-cell .mark { font-size: 9px; margin-top: 2px; }
.day-cell .note-dot {
  position: absolute; bottom: -1px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent-warm-1); display: none;
}
.day-cell.has-note .note-dot { display: block; }

.day-cell.answered { background: var(--accent-green-bg); color: #39694a; }
.day-cell.unanswered { background: transparent; color: var(--disabled); }
.day-cell.today { background: #fff; color: var(--accent-warm-2); box-shadow: 0 0 0 2.5px var(--accent-warm-3), 0 6px 16px rgba(200,120,100,.25); animation: glowPulse 2.2s ease-in-out infinite; }
.day-cell.future { background: var(--locked-bg); color: var(--locked-fg); }

.legend-row { display: flex; gap: 14px; justify-content: center; margin-top: 16px; font-size: 10.5px; font-weight: 700; color: var(--muted-2); letter-spacing: .02em; }
.legend-note { color: var(--accent-warm-1); }

/* Progress card */
.progress-card { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.progress-track { height: 8px; border-radius: 99px; background: var(--track); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; width: 0%; transition: width .3s ease; }
.progress-fill--warm { background: linear-gradient(90deg,#ffb99a,#ff8f8f); }
.progress-fill--green { background: linear-gradient(90deg,#bfe9c6,#8fd6a3); }
.progress-label { font-size: 12.5px; font-weight: 700; color: var(--muted-1); margin-top: 8px; }
.progress-accent--warm { color: var(--accent-warm-1); }
.progress-accent--green { color: var(--accent-green-1); }

.gifts-btn {
  width: 100%; min-height: 48px; border: 1.5px solid rgba(230,148,124,.5); border-radius: 16px;
  background: linear-gradient(140deg,#fff2ea,#ffe0e4); font-weight: 800; font-size: 13.5px; letter-spacing: .06em;
  color: #8a4a38; display: flex; align-items: center; justify-content: center; gap: 9px;
}
.gifts-btn:hover { filter: brightness(1.03); }
.gifts-btn-icon { font-size: 18px; }

/* Day page */
.day-header { display: flex; align-items: center; gap: 12px; }
.back-btn {
  width: 44px; height: 44px; flex: 0 0 44px; border: 1px solid rgba(255,255,255,.85); border-radius: 15px;
  background: rgba(255,255,255,.7); font-size: 18px; color: #8a5346; display: flex; align-items: center; justify-content: center;
}
.back-btn:hover { background: #fff; }
.day-date-label { font-family: 'Cormorant Garamond', serif; font-size: 23px; font-weight: 700; color: var(--ink-2); line-height: 1.1; }
.day-sub-label { font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: .14em; color: #b08a7f; margin-top: 3px; }

.question-card {
  background: linear-gradient(160deg, rgba(255,255,255,.85), rgba(255,240,232,.6));
  border: 1.5px solid rgba(255,255,255,.9); border-radius: 24px; box-shadow: 0 14px 34px rgba(186,124,105,.18); padding: 20px;
}
.eyebrow { font-size: 11px; font-weight: 800; letter-spacing: .12em; margin-bottom: 10px; }
.eyebrow--muted { color: var(--muted-2); }
.eyebrow--green { color: #8fbf9c; margin-bottom: 9px; }
.eyebrow--pink { color: #c0644a; letter-spacing: .1em; margin-bottom: 0; }
.question-text { font-family: 'Cormorant Garamond', serif; font-weight: 700; font-size: 24px; line-height: 1.25; color: var(--ink-1); }

.composer-card {
  background: rgba(255,255,255,.7); border: 1px solid rgba(255,255,255,.9); border-radius: 22px;
  box-shadow: 0 10px 26px rgba(186,124,105,.14); padding: 16px;
}
.answer-input {
  width: 100%; border: 1px solid rgba(214,168,150,.5); background: rgba(255,255,255,.8); border-radius: 16px;
  padding: 14px; font-size: 15px; color: #5e332c; outline: none;
}
.answer-input:focus { border-color: #e6947c; box-shadow: 0 0 0 4px rgba(230,148,124,.16); }
.submit-btn {
  margin-top: 10px; width: 100%; min-height: 48px; border: none; border-radius: 16px; font-weight: 800; font-size: 15px;
  letter-spacing: .08em; color: #7a3226; background: linear-gradient(100deg,#ffd9c2,#ffc0c8 55%,#c8f0cf);
  box-shadow: 0 8px 20px rgba(224,140,116,.32);
}
.submit-btn:hover { filter: brightness(1.04); }
.submit-btn:active { transform: translateY(1px); }
.submit-btn:disabled { opacity: .55; cursor: default; }
.photo-btn {
  margin-top: 8px; width: 100%; min-height: 46px; border: 1.5px solid rgba(214,168,150,.6); border-radius: 16px;
  background: rgba(255,255,255,.55); font-weight: 700; font-size: 14px; letter-spacing: .06em; color: #8a5346;
}
.photo-btn:hover { background: rgba(255,255,255,.85); }
.attachment-chip {
  margin-top: 10px; display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 16px;
  background: rgba(255,240,232,.75); border: 1px solid rgba(230,206,195,.7); animation: floatUp .25s ease both;
}
.attachment-thumb {
  width: 52px; height: 52px; flex: 0 0 52px; border-radius: 12px; background-size: cover; background-position: center;
  border: 1px solid rgba(255,255,255,.9);
}
.attachment-title { font-weight: 800; font-size: 13px; color: #7a4438; }
.attachment-filename { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; color: #ac8477; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.answer-card {
  background: rgba(255,255,255,.78); border: 1px solid rgba(255,255,255,.95); border-radius: 22px;
  box-shadow: 0 10px 26px rgba(186,124,105,.14); padding: 18px;
}
.answer-text { font-size: 15px; line-height: 1.6; color: var(--ink-3); }
.answer-photo-wrap { margin-top: 13px; border-radius: 18px; overflow: hidden; border: 1px solid rgba(230,206,195,.8); }
.answer-photo { display: block; width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.answer-time { font-family: 'IBM Plex Mono', monospace; font-size: 10px; color: #bda199; margin-top: 10px; }

.note-card {
  background: linear-gradient(150deg,#fff1e6,#ffe2e6); border: 1.5px solid rgba(255,255,255,.9); border-radius: 22px;
  box-shadow: 0 10px 26px rgba(224,140,116,.18); padding: 18px; display: flex; gap: 13px;
}
.note-icon { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 14px; background: rgba(255,255,255,.85); display: flex; align-items: center; justify-content: center; font-size: 18px; }
.note-text { font-size: 14.5px; line-height: 1.6; color: #7a4438; margin-top: 6px; }

.admin-note-editor {
  background: linear-gradient(150deg,#fff1e6,#ffe2e6); border: 1.5px solid rgba(255,255,255,.9); border-radius: 22px;
  box-shadow: 0 10px 26px rgba(224,140,116,.18); padding: 18px;
}
.admin-note-input {
  width: 100%; min-height: 90px; resize: vertical; border: 1px solid rgba(214,168,150,.5); background: rgba(255,255,255,.8);
  border-radius: 16px; padding: 14px; font-size: 14.5px; color: #5e332c; outline: none; margin-top: 8px;
}
.admin-note-input:focus { border-color: #e6947c; box-shadow: 0 0 0 4px rgba(230,148,124,.16); }

.gift-card {
  border-radius: 22px; padding: 18px; background: linear-gradient(120deg,#ffe6d2,#ffd3d8);
  border: 1px solid rgba(255,255,255,.85); display: flex; align-items: center; gap: 14px;
}
.gift-icon { width: 46px; height: 46px; border-radius: 14px; background: rgba(255,255,255,.8); display: flex; align-items: center; justify-content: center; font-size: 22px; }
.gift-title { font-weight: 800; font-size: 14px; color: #7a3226; }
.gift-subtitle { font-size: 12.5px; color: #96604f; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); z-index: 40;
  background: rgba(88,45,38,.94); color: #ffeee6; padding: 12px 18px; border-radius: 16px;
  font-size: 13.5px; font-weight: 700; box-shadow: 0 10px 26px rgba(90,45,38,.3); animation: toastIn .22s ease both;
  white-space: nowrap;
}

/* Gifts sheet */
.gifts-overlay { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.gifts-scrim { position: absolute; inset: 0; background: rgba(94,52,44,.35); backdrop-filter: blur(3px); }
.gifts-sheet {
  position: relative; width: 100%; max-width: 430px; background: linear-gradient(180deg,#fffaf7,#ffeee6);
  border-radius: 26px 26px 0 0; padding: 20px 20px 28px; animation: sheetIn .28s cubic-bezier(.2,.8,.3,1) both;
  max-height: 82vh; display: flex; flex-direction: column;
}
.sheet-handle { width: 44px; height: 4px; border-radius: 99px; background: #e6cec3; margin: 0 auto 16px; flex: 0 0 auto; }
.sheet-header-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex: 0 0 auto; }
.sheet-title { font-family: 'Cormorant Garamond', serif; font-size: 24px; font-weight: 700; color: var(--ink-1); margin-bottom: 14px; flex: 0 0 auto; }
.sheet-header-row .sheet-title { margin-bottom: 0; }
.sheet-close { width: 36px; height: 36px; flex: 0 0 36px; font-size: 15px; }
.gifts-list { flex: 1 1 auto; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.gift-row {
  display: flex; align-items: center; gap: 13px; padding: 13px 14px; border-radius: 18px;
  background: rgba(255,255,255,.8); border: 1px solid rgba(230,206,195,.6); cursor: pointer;
}
.gift-content {
  margin: 6px 0 0; padding: 12px 14px; border-radius: 16px;
  background: rgba(255,240,232,.6); border: 1px solid rgba(230,206,195,.5);
}
.gift-content-text { font-size: 14px; line-height: 1.6; color: #7a4438; white-space: pre-wrap; }
.gift-content-input { margin-top: 0; min-height: 80px; }
.gift-content-save { margin-top: 8px; min-height: 40px; font-size: 13px; }
.gift-media-player { width: 100%; display: block; border-radius: 12px; }
.question-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gift-media-upload-label {
  display: flex; align-items: center; justify-content: center; margin-top: 8px; min-height: 40px; font-size: 13px;
}
.gift-row-icon {
  width: 40px; height: 40px; border-radius: 13px; background: linear-gradient(140deg,#ffe1d0,#ffd0d6);
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}

/* Gift detail -- a full page above the gifts sheet, not a partial bottom sheet.
   Header stays fixed; only the body (the letter/player) scrolls. */
.gift-detail-overlay {
  position: fixed; inset: 0; z-index: 60;
  display: flex; justify-content: center;
  background: radial-gradient(120% 80% at 50% 0%, #fde3d6 0%, #f9d9dd 45%, #f2e6d8 100%);
}
.gift-detail-page {
  width: 100%; max-width: 430px; height: 100%;
  background: linear-gradient(180deg, rgba(255,252,250,.55), rgba(255,246,240,.25));
  display: flex; flex-direction: column;
  animation: slideIn .3s ease both;
}
.gift-detail-page > .day-header { flex: 0 0 auto; padding: 22px 16px 14px; }
.gift-detail-body { flex: 1 1 auto; overflow-y: auto; padding: 0 16px 14px; }
.gift-detail-body .gift-content { margin-top: 0; }
.gift-content--edit { height: 100%; display: flex; flex-direction: column; }
.gift-detail-footer { flex: 0 0 auto; padding: 10px 16px calc(16px + env(safe-area-inset-bottom)); }
.gift-content--edit .gift-content-input { flex: 1 1 auto; }
.gift-row-title { font-weight: 800; font-size: 14px; color: #6b3f34; }
.gift-row-date { font-size: 12px; color: #9b7264; }
.gift-row-state { font-size: 11px; font-weight: 800; letter-spacing: .06em; margin-left: auto; }

/* Confetti */
.confetti-layer { position: absolute; inset: 0; pointer-events: none; z-index: 30; }
.confetti-piece { position: absolute; top: 0; border-radius: 2px; }

[hidden] { display: none !important; }
