:root {
  --pink-1: #fff0f5;
  --pink-2: #ffd6e6;
  --pink-3: #ffb3cc;
  --pink-4: #ff8fab;
  --red: #ff4d6d;
  --red-deep: #d81e5b;
  --ink: #7a2942;
  --ink-soft: #9c5a6f;
  --card-bg: rgba(255, 255, 255, 0.55);
  --card-border: rgba(255, 255, 255, 0.7);
  --shadow: 0 18px 40px rgba(216, 30, 91, 0.18);
  --font: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  --script: "Pacifico", cursive;
  --hand: "Dancing Script", cursive;
}

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

html, body { min-height: 100%; font-family: var(--font); color: var(--ink); }
body {
  background: linear-gradient(135deg, var(--pink-1), var(--pink-2) 45%, var(--pink-3) 100%);
  background-size: 300% 300%;
  animation: bgShift 22s ease infinite;
  min-height: 100dvh;
  position: relative;
  overflow-x: hidden;
}
@keyframes bgShift { 0%{background-position:0% 50%;}50%{background-position:100% 50%;}100%{background-position:0% 50%;} }

.hidden { display: none !important; }

/* Material Symbols base */
.mi { font-family: 'Material Symbols Rounded'; font-weight: normal; font-style: normal; line-height: 1; letter-spacing: normal; text-transform: none; display: inline-block; white-space: nowrap; word-wrap: normal; direction: ltr; -webkit-font-feature-settings: 'liga'; -webkit-font-smoothing: antialiased; font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24; user-select: none; }
.mi.fill { font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24; }

/* soft aurora blobs */
.blob { position: fixed; border-radius: 50%; filter: blur(60px); opacity: .5; z-index: 0; pointer-events: none; }
.blob-1 { width: 320px; height: 320px; background: #ff9ec4; top: -80px; left: -60px; animation: drift1 16s ease-in-out infinite; }
.blob-2 { width: 300px; height: 300px; background: #ffc6a0; bottom: -70px; right: -50px; animation: drift2 19s ease-in-out infinite; }
@keyframes drift1 { 0%,100%{transform:translate(0,0) scale(1);}50%{transform:translate(40px,30px) scale(1.15);} }
@keyframes drift2 { 0%,100%{transform:translate(0,0) scale(1);}50%{transform:translate(-30px,-40px) scale(1.1);} }

/* hearts */
.hearts { position: fixed; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
.heart { position: absolute; bottom: -40px; color: var(--red); opacity: 0; animation: floatUp linear infinite; filter: drop-shadow(0 2px 4px rgba(216,30,91,.25)); }
@keyframes floatUp {
  0%{transform:translateY(0) rotate(0) scale(1);opacity:0;}
  10%{opacity:.85;}
  50%{transform:translateY(-55vh) rotate(180deg) scale(1.1);opacity:.8;}
  90%{opacity:.35;}
  100%{transform:translateY(-110vh) rotate(360deg) scale(.9);opacity:0;}
}

.demo-badge { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 30; font-size: 12px; font-weight: 600; letter-spacing: .3px; color: #fff; background: rgba(216,30,91,.85); padding: 5px 14px; border-radius: 999px; box-shadow: 0 6px 16px rgba(216,30,91,.35); }

.screen { position: relative; z-index: 2; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; }

.title { font-family: var(--script); font-size: clamp(46px,15vw,88px); font-weight: 400; color: var(--red-deep); text-shadow: 0 4px 0 rgba(255,255,255,.7), 0 12px 30px rgba(216,30,91,.3); animation: pop 1s cubic-bezier(.2,.9,.3,1.4) both; line-height: 1.05; }
@keyframes pop { 0%{transform:scale(.5) rotate(-6deg);opacity:0;}100%{transform:none;opacity:1;} }
.subtitle { font-size: clamp(14px,3.8vw,17px); font-weight: 400; color: var(--ink-soft); margin-top: 6px; letter-spacing: .2px; }
.msg { font-size: 13px; min-height: 18px; margin-top: 8px; font-weight: 500; }
.msg.err { color: var(--red-deep); }
.msg.ok { color: #1f9d55; }

/* ---- PIN gate ---- */
.gate { justify-content: center; gap: 20px; padding: 24px; text-align: center; }
.pin-display { display: flex; gap: 14px; margin-top: 4px; }
.pin-dot { width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--pink-4); background: transparent; transition: .18s cubic-bezier(.2,.9,.3,1.4); }
.pin-dot.filled { background: var(--red); border-color: var(--red); transform: scale(1.25); box-shadow: 0 0 0 6px rgba(255,77,109,.15); }
.keypad { display: grid; grid-template-columns: repeat(3, 74px); gap: 16px; margin-top: 8px; }
.keypad button { width: 74px; height: 74px; border-radius: 24px; border: 1px solid var(--card-border); font-family: var(--font); font-size: 26px; font-weight: 600; color: var(--red-deep); background: var(--card-bg); backdrop-filter: blur(12px); box-shadow: 0 8px 20px rgba(216,30,91,.12); cursor: pointer; transition: transform .12s, background .2s; }
.keypad button:active { transform: scale(.9); background: #fff; }
.keypad .key-alt { font-size: 20px; color: var(--pink-4); background: rgba(255,255,255,.4); }

/* ---- home ---- */
.home { padding: 56px 16px 100px; gap: 16px; }
.home-top { text-align: center; }
.greeting { font-family: var(--hand); font-size: clamp(26px,8vw,40px); font-weight: 700; color: var(--red-deep); }
.clock { font-size: clamp(13px,4vw,16px); font-weight: 500; color: var(--ink-soft); margin-top: 2px; letter-spacing: 2px; }

.doodles { display: flex; align-items: flex-start; justify-content: center; gap: clamp(14px,10vw,72px); margin: 4px 0; }
.middle-heart { align-self: center; font-size: clamp(30px,9vw,52px); color: var(--red); animation: beat 1.1s ease-in-out infinite; filter: drop-shadow(0 6px 12px rgba(216,30,91,.35)); }
@keyframes beat { 0%,100%{transform:scale(1);}25%{transform:scale(1.28);}40%{transform:scale(.94);} }

.counts-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.count-chip { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 999px; padding: 8px 16px; font-size: 13px; font-weight: 500; backdrop-filter: blur(12px); box-shadow: 0 6px 16px rgba(216,30,91,.1); }
.count-chip b { color: var(--red-deep); font-size: 16px; font-weight: 700; margin-left: 2px; }

.section-title { font-family: var(--hand); font-size: 22px; font-weight: 700; color: var(--ink); margin-top: 10px; }

.cards { width: min(560px, 94vw); display: flex; flex-direction: column; gap: 16px; }
.empty { text-align: center; color: var(--ink-soft); padding: 30px; font-size: 15px; }

.card { position: relative; background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 24px; padding: 16px 18px; backdrop-filter: blur(14px); box-shadow: var(--shadow); overflow: hidden; }
.card::before { content: ""; position: absolute; top: 0; left: 0; width: 5px; height: 100%; background: linear-gradient(var(--pink-4), var(--red)); }
.card.reveal { animation: cardIn .55s cubic-bezier(.2,.9,.3,1.2) both; }
@keyframes cardIn { 0%{opacity:0; transform:translateY(20px) scale(.96);}100%{opacity:1; transform:none;} }
.card-from { font-size: 12px; font-weight: 600; color: var(--pink-4); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }
.card-text { font-size: 16px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; color: var(--ink); }
.card--text .card-text { font-family: var(--hand); font-size: 22px; line-height: 1.4; }
.card-photo { width: 100%; border-radius: 16px; margin-top: 4px; display: block; box-shadow: 0 8px 20px rgba(216,30,91,.15); }
.card-meta { display: flex; justify-content: flex-end; margin-top: 10px; }
.read-count { font-size: 12px; font-weight: 500; color: var(--ink-soft); background: rgba(255,255,255,.6); padding: 3px 10px; border-radius: 999px; }

/* ---- voice player ---- */
.voice { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.5); border-radius: 999px; padding: 8px 12px; }
.voice-play { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; border: none; background: linear-gradient(135deg, var(--pink-4), var(--red)); color: #fff; cursor: pointer; box-shadow: 0 6px 14px rgba(255,77,109,.4); display: flex; align-items: center; justify-content: center; }
.voice-play .mi { font-size: 22px; }
.voice-wave { flex: 1; display: flex; align-items: center; gap: 2px; height: 28px; overflow: hidden; }
.voice-wave span { flex: 1; background: var(--red); opacity: .4; border-radius: 3px; min-width: 2px; }
.voice-bar { flex: 0 0 44px; height: 4px; background: rgba(255,77,109,.22); border-radius: 4px; overflow: hidden; }
.voice-progress { height: 100%; width: 0; background: var(--red); }
.voice-time { font-size: 11px; color: var(--ink-soft); min-width: 30px; text-align: right; }

/* ---- bottom bar + fab ---- */
.bottom-bar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(to top, rgba(255,240,245,.98), rgba(255,240,245,0)); }
.whoami { font-size: 12px; color: var(--ink-soft); font-weight: 500; }
.admin-entry { font-size: 13px; color: var(--red-deep); text-decoration: none; font-weight: 700; }
.logout { border: none; background: rgba(255,255,255,.7); color: var(--ink); border-radius: 999px; padding: 7px 16px; font-size: 13px; font-weight: 500; cursor: pointer; font-family: var(--font); }
.fab { position: fixed; right: 18px; bottom: 68px; z-index: 6; width: 62px; height: 62px; border-radius: 50%; border: none; background: linear-gradient(135deg, var(--pink-4), var(--red)); color: #fff; font-size: 32px; line-height: 1; box-shadow: 0 12px 28px rgba(216,30,91,.45); cursor: pointer; animation: floatFab 3s ease-in-out infinite; }
@keyframes floatFab { 0%,100%{transform:translateY(0);}50%{transform:translateY(-7px);} }
.fab:active { transform: scale(.92); }
.fab .mi { font-size: 30px; }
.fab-mic .mi { font-size: 28px; }

/* transparent mic button (glassy) sitting above the compose fab.
   touch-action:none lets us capture the press-and-slide gesture. */
.fab-mic { bottom: 138px; background: rgba(255,255,255,.28); color: var(--red-deep); border: 1.5px solid rgba(255,255,255,.65); backdrop-filter: blur(10px); box-shadow: 0 8px 22px rgba(216,30,91,.22); display: flex; align-items: center; justify-content: center; animation: floatFab 3.4s ease-in-out infinite; touch-action: none; user-select: none; -webkit-user-select: none; }
.fab-mic:active { transform: scale(.92); }
/* while recording, the mic glows */
.ig-rec:not(.hidden) ~ .fab-mic, .recording-mic { background: linear-gradient(135deg, var(--pink-4), var(--red)) !important; color: #fff !important; }

/* ---- Instagram-style inline voice recorder ---- */
.ig-rec { position: fixed; left: 12px; right: 12px; bottom: 64px; z-index: 8; display: flex; align-items: center; justify-content: flex-end; pointer-events: none; }
.ig-rec > * { pointer-events: auto; }

.ig-bar { flex: 1; display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 14px; margin-right: 10px; background: rgba(255,255,255,.75); border: 1px solid var(--card-border); border-radius: 999px; backdrop-filter: blur(14px); box-shadow: 0 10px 26px rgba(216,30,91,.2); overflow: hidden; animation: barIn .25s ease; }
@keyframes barIn { 0%{opacity:0; transform:translateX(20px);}100%{opacity:1;transform:none;} }
.ig-bar.cancelling { background: rgba(216,30,91,.15); }
.ig-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--red-deep); flex: 0 0 auto; animation: recBlink 1s infinite; }
@keyframes recBlink { 0%,100%{opacity:1;}50%{opacity:.25;} }
.ig-timer { font-size: 15px; font-weight: 700; color: var(--red-deep); font-variant-numeric: tabular-nums; min-width: 40px; }
.ig-wave { flex: 1; height: 34px; min-width: 0; }
.ig-cancel-hint { font-size: 12px; color: var(--ink-soft); white-space: nowrap; animation: slideHint 1.6s ease-in-out infinite; }
@keyframes slideHint { 0%,100%{opacity:.5; transform:translateX(0);}50%{opacity:1; transform:translateX(-4px);} }
.ig-bar.cancelling .ig-cancel-hint { color: var(--red-deep); font-weight: 700; }

/* lock hint floating above the mic */
.ig-lock { position: absolute; right: 22px; bottom: 74px; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--ink-soft); background: rgba(255,255,255,.8); border-radius: 999px; padding: 8px 6px; box-shadow: 0 6px 16px rgba(216,30,91,.2); animation: lockBounce 1.5s ease-in-out infinite; }
@keyframes lockBounce { 0%,100%{transform:translateY(0);}50%{transform:translateY(-6px);} }
.ig-lock .mi { font-size: 18px; }
.ig-lock-arrow { font-size: 16px !important; line-height: 1; }
.ig-ctrl .mi { font-size: 18px; }
.ig-lock.locked { color: #fff; background: var(--red-deep); animation: none; }

/* locked-mode controls */
.ig-locked-controls { display: flex; align-items: center; gap: 8px; }
.ig-ctrl { border: none; width: 38px; height: 38px; border-radius: 50%; font-size: 15px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.ig-trash { background: rgba(255,255,255,.85); color: var(--red-deep); }
.ig-stop { background: var(--red-deep); color: #fff; }
.ig-go { background: linear-gradient(135deg, var(--pink-4), var(--red)); color: #fff; box-shadow: 0 6px 14px rgba(255,77,109,.4); }
.ig-preview { height: 34px; max-width: 150px; }
.ig-msg { position: absolute; bottom: -22px; right: 76px; }

/* ---- composer sheet ---- */
.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(122,41,66,.4); backdrop-filter: blur(3px); display: flex; align-items: flex-end; justify-content: center; }
.sheet-card { width: min(560px,100%); background: linear-gradient(180deg, #fff6f9, #ffeef4); border-radius: 30px 30px 0 0; padding: 20px 20px 28px; box-shadow: 0 -14px 44px rgba(216,30,91,.25); animation: sheetUp .3s cubic-bezier(.2,.9,.3,1.1); max-height: 92dvh; overflow-y: auto; }
@keyframes sheetUp { 0%{transform:translateY(100%);}100%{transform:none;} }
.sheet-head { display: flex; justify-content: space-between; align-items: center; font-size: 15px; font-weight: 500; margin-bottom: 14px; }
.sheet-head b { color: var(--red-deep); }
.sheet-close { border: none; background: rgba(255,255,255,.7); width: 34px; height: 34px; border-radius: 50%; cursor: pointer; color: var(--ink); display: flex; align-items: center; justify-content: center; }
.sheet-close .mi { font-size: 20px; }
.keypad .key-alt .mi { font-size: 24px; }
.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tab { flex: 1; padding: 11px; border: 1px solid var(--card-border); background: rgba(255,255,255,.6); border-radius: 16px; font-size: 14px; font-weight: 500; font-family: var(--font); cursor: pointer; color: var(--ink); transition: .2s; display: flex; align-items: center; justify-content: center; gap: 5px; }
.tab .mi { font-size: 18px; }
.tab.active { background: linear-gradient(135deg, var(--pink-4), var(--red)); color: #fff; border-color: transparent; box-shadow: 0 8px 18px rgba(255,77,109,.35); }
.tab-pane textarea, .tab-pane input[type=text] { width: 100%; border: 1px solid rgba(255,143,171,.5); border-radius: 16px; padding: 14px; font-size: 16px; font-family: var(--font); margin-bottom: 10px; background: rgba(255,255,255,.7); color: var(--ink); }
.tab-pane textarea:focus, .tab-pane input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 4px rgba(255,77,109,.12); }
.tab-pane textarea { min-height: 120px; resize: vertical; }
.tab-pane input[type=file] { width: 100%; margin-bottom: 10px; font-size: 13px; }
/* native-style photo source chooser */
.photo-sources { display: flex; gap: 12px; margin-bottom: 12px; }
.photo-source { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 22px 12px; border: 1px solid var(--card-border); border-radius: 18px; background: rgba(255,255,255,.6); color: var(--ink); font-family: var(--font); font-size: 14px; font-weight: 600; cursor: pointer; transition: transform .12s, background .2s; }
.photo-source .mi { font-size: 34px; color: var(--red); }
.photo-source:active { transform: scale(.96); background: #fff; }

.photo-frame { position: relative; margin-bottom: 12px; }
.photo-preview { width: 100%; border-radius: 16px; display: block; box-shadow: 0 8px 20px rgba(216,30,91,.15); }
.photo-clear { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border-radius: 50%; border: none; background: rgba(0,0,0,.55); color: #fff; cursor: pointer; z-index: 2; display: flex; align-items: center; justify-content: center; }
.photo-clear .mi { font-size: 20px; }

/* live camera modal */
.cam-modal { position: fixed; inset: 0; z-index: 50; background: #000; display: flex; flex-direction: column; }
.cam-top { position: absolute; top: 0; left: 0; right: 0; z-index: 2; display: flex; justify-content: space-between; padding: 16px calc(16px + env(safe-area-inset-right)) 16px calc(16px + env(safe-area-inset-left)); padding-top: calc(16px + env(safe-area-inset-top)); }
.cam-x, .cam-flip { width: 44px; height: 44px; border-radius: 50%; border: none; background: rgba(255,255,255,.18); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(6px); }
.cam-x .mi, .cam-flip .mi { font-size: 24px; }
.cam-video { flex: 1; width: 100%; height: 100%; object-fit: cover; }
.cam-bottom { position: absolute; bottom: 0; left: 0; right: 0; z-index: 2; display: flex; justify-content: center; padding: 0 0 calc(32px + env(safe-area-inset-bottom)); }
.cam-shutter { width: 74px; height: 74px; border-radius: 50%; border: 5px solid rgba(255,255,255,.85); background: #fff; cursor: pointer; box-shadow: 0 0 0 3px rgba(255,255,255,.3); transition: transform .1s; }
.cam-shutter:active { transform: scale(.9); }
.recorder { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.rec-btn { border: none; background: linear-gradient(135deg, var(--pink-4), var(--red)); color: #fff; padding: 13px 22px; border-radius: 999px; font-size: 15px; font-weight: 600; font-family: var(--font); cursor: pointer; box-shadow: 0 8px 18px rgba(255,77,109,.35); display: inline-flex; align-items: center; gap: 6px; }
.rec-btn .mi { font-size: 18px; }
.send-btn .mi, .admin-entry .mi, .logout .mi { vertical-align: -3px; }
.rec-btn.recording { animation: pulse 1.1s infinite; background: var(--red-deep); }
@keyframes pulse { 0%,100%{box-shadow:0 0 0 0 rgba(216,30,91,.5);}50%{box-shadow:0 0 0 14px rgba(216,30,91,0);} }
.rec-time { font-size: 18px; font-weight: 700; color: var(--red-deep); }
.rec-hint { font-size: 12px; color: var(--ink-soft); margin-bottom: 6px; }
#voicePreview { width: 100%; margin-bottom: 10px; }
.schedule { background: rgba(255,255,255,.6); border: 1px solid var(--card-border); border-radius: 16px; padding: 14px; margin-bottom: 12px; display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.schedule input { border: 1px solid rgba(255,143,171,.5); border-radius: 10px; padding: 8px; margin-left: 6px; font-family: var(--font); }
.send-btn { width: 100%; padding: 15px; border: none; border-radius: 18px; background: linear-gradient(135deg, var(--pink-4), var(--red)); color: #fff; font-size: 17px; font-weight: 700; font-family: var(--font); cursor: pointer; box-shadow: 0 10px 24px rgba(255,77,109,.4); transition: transform .12s; }
.send-btn:active { transform: scale(.98); }

/* ---- doodle characters ---- */
.character { position: relative; width: 96px; height: 132px; animation: sway 3.2s ease-in-out infinite; filter: drop-shadow(0 8px 12px rgba(216,30,91,.18)); }
.character--anshu { animation-delay: .6s; }
@keyframes sway { 0%,100%{transform:rotate(-3deg) translateY(0);}50%{transform:rotate(3deg) translateY(-6px);} }
.head { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 58px; height: 58px; background: #ffe3cd; border-radius: 50%; border: 3px solid var(--ink); z-index: 3; }
.hair { position: absolute; top: -8px; left: -4px; width: 66px; height: 30px; background: #40292f; border-radius: 36px 36px 0 0; }
.hair--long::after { content: ""; position: absolute; top: 18px; left: -4px; width: 74px; height: 42px; background: #40292f; border-radius: 0 0 36px 36px; z-index: -1; }
.eye { position: absolute; top: 26px; width: 7px; height: 7px; background: var(--ink); border-radius: 50%; animation: blink 4s infinite; }
.eye--l { left: 16px; } .eye--r { right: 16px; }
@keyframes blink { 0%,92%,100%{transform:scaleY(1);}96%{transform:scaleY(.1);} }
.blush { position: absolute; top: 35px; width: 11px; height: 6px; background: var(--red); opacity: .55; border-radius: 50%; }
.blush--l { left: 9px; } .blush--r { right: 9px; }
.smile { position: absolute; top: 35px; left: 50%; transform: translateX(-50%); width: 20px; height: 11px; border-bottom: 3px solid var(--ink); border-radius: 0 0 20px 20px; }
.body { position: absolute; top: 52px; left: 50%; transform: translateX(-50%); width: 52px; height: 66px; background: linear-gradient(var(--red), var(--red-deep)); border: 3px solid var(--ink); border-radius: 24px 24px 14px 14px; z-index: 2; }
.body--dress { background: linear-gradient(#ff8fab, #ff6b95); width: 38px; clip-path: polygon(20% 0,80% 0,100% 100%,0 100%); }
.arm { position: absolute; top: 58px; width: 11px; height: 40px; background: #ffe3cd; border: 3px solid var(--ink); border-radius: 10px; z-index: 1; }
.arm--l { left: 14px; transform-origin: top center; animation: waveL 2.4s ease-in-out infinite; }
.arm--r { right: 14px; transform-origin: top center; animation: waveR 2.4s ease-in-out infinite; }
@keyframes waveL { 0%,100%{transform:rotate(20deg);}50%{transform:rotate(45deg);} }
@keyframes waveR { 0%,100%{transform:rotate(-20deg);}50%{transform:rotate(-45deg);} }
