/* ---------- theme ---------- */
:root{
  --bg:#fbf3ee; --card:#ffffff; --ink:#3d2b2b; --muted:#8a736e;
  --rose:#c25e7c; --rose-deep:#9d3f5e; --gold:#d9a441;
  --line:#efe0d8; --shadow:0 8px 28px rgba(120,70,70,.12);
  --radius:20px;
}
:root[data-theme="dark"]{
  --bg:#1b1512; --card:#271d1a; --ink:#f4e8e2; --muted:#b39a92;
  --rose:#e0839f; --rose-deep:#c96a88; --gold:#e6b45c;
  --line:#3a2b26; --shadow:0 8px 28px rgba(0,0,0,.35);
}
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]){
    --bg:#1b1512; --card:#271d1a; --ink:#f4e8e2; --muted:#b39a92;
    --rose:#e0839f; --rose-deep:#c96a88; --gold:#e6b45c;
    --line:#3a2b26; --shadow:0 8px 28px rgba(0,0,0,.35);
  }
}

*{box-sizing:border-box}
html,body{margin:0}
body{
  font-family:Nunito,system-ui,-apple-system,Segoe UI,Roboto,sans-serif;
  background:var(--bg); color:var(--ink);
  -webkit-font-smoothing:antialiased;
  padding-bottom:40px;
}
h1,h2,h3{font-family:Fraunces,Georgia,serif; font-weight:600; line-height:1.2}
h2{font-size:1.15rem; margin:0 0 .7rem}
h3{font-size:1rem; margin:1.2rem 0 .5rem}
p{line-height:1.55}
a{color:var(--rose-deep)}
.muted{color:var(--muted)}
.small{font-size:.85rem}
.center{text-align:center}
.err{color:#c0392b; font-size:.9rem; margin:.4rem 0}
.ok{color:var(--rose-deep); font-weight:700}

/* ---------- layout ---------- */
.appbar{
  position:sticky; top:0; z-index:20;
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 18px; background:color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter:blur(8px); border-bottom:1px solid var(--line);
}
.brand{font-family:Fraunces,serif; font-weight:700; font-size:1.25rem; display:flex; gap:.4rem; align-items:center}
.appbar-right{display:flex; align-items:center; gap:10px}
.who{font-size:.82rem; color:var(--muted)}
.icon-btn{
  border:1px solid var(--line); background:var(--card); color:var(--ink);
  width:38px; height:38px; border-radius:12px; font-size:1rem; cursor:pointer;
}

.chips{
  position:sticky; top:57px; z-index:19;
  display:flex; gap:8px; overflow-x:auto; padding:10px 18px;
  background:color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter:blur(8px);
  scrollbar-width:none;
}
.chips::-webkit-scrollbar{display:none}
.chips button{
  flex:0 0 auto; border:1px solid var(--line); background:var(--card); color:var(--muted);
  padding:6px 14px; border-radius:999px; font:inherit; font-size:.85rem; cursor:pointer;
}
.chips button.active{background:var(--rose); color:#fff; border-color:var(--rose)}

main{max-width:760px; margin:0 auto; padding:18px}
.section{scroll-margin-top:110px; margin-bottom:8px}
.card{
  background:var(--card); border:1px solid var(--line); border-radius:var(--radius);
  padding:20px; margin-bottom:18px; box-shadow:var(--shadow);
}

/* ---------- hero ---------- */
.hero{
  background:linear-gradient(150deg,var(--rose),var(--rose-deep));
  color:#fff; border:none; text-align:center;
}
.hero-kicker{margin:0; letter-spacing:.12em; text-transform:uppercase; font-size:.72rem; opacity:.9}
.bigclock{
  font-family:Fraunces,serif; font-weight:700;
  font-size:clamp(1.7rem,7vw,2.9rem); margin:.35rem 0 .8rem; font-variant-numeric:tabular-nums;
}
.hero-due{margin:.6rem 0 0; font-size:.9rem; opacity:.92}
.progress{height:8px; background:rgba(255,255,255,.28); border-radius:999px; overflow:hidden}
.progress.slim{height:6px; background:var(--line); margin-bottom:14px}
.bar{height:100%; width:0; background:#fff; border-radius:999px; transition:width .6s}
.progress.slim .bar{background:var(--rose)}

/* ---------- counters ---------- */
.counter-grid{display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:12px}
.counter{background:var(--bg); border:1px solid var(--line); border-radius:14px; padding:14px; text-align:center}
.counter .n{font-family:Fraunces,serif; font-weight:700; font-size:1.8rem; color:var(--rose-deep); font-variant-numeric:tabular-nums}
.counter .l{font-size:.8rem; color:var(--muted); margin-top:2px}

/* ---------- events ---------- */
.event-list{display:flex; flex-direction:column; gap:8px; margin-bottom:12px}
.event{display:flex; align-items:center; gap:10px; background:var(--bg); border:1px solid var(--line); border-radius:12px; padding:10px 12px}
.event .ev-emoji{font-size:1.2rem}
.event .ev-main{flex:1; min-width:0}
.event .ev-title{font-weight:700}
.event .ev-sub{font-size:.8rem; color:var(--muted)}
.event .ev-cd{font-weight:700; color:var(--rose-deep); font-variant-numeric:tabular-nums}
.x-btn{border:none; background:none; color:var(--muted); cursor:pointer; font-size:1rem; padding:4px}

/* ---------- clocks ---------- */
.clocks{display:grid; grid-template-columns:1fr 1fr; gap:12px}
.clock{border-radius:16px; padding:16px; text-align:center; border:1px solid var(--line)}
.clock.day{background:linear-gradient(160deg,#fff5e0,#ffe4c4); color:#5b4326}
.clock.night{background:linear-gradient(160deg,#2b2f52,#1c1f3a); color:#e9ecff}
.clock .city{font-weight:700; font-size:.9rem}
.clock .time{font-family:Fraunces,serif; font-weight:700; font-size:2rem; font-variant-numeric:tabular-nums; margin:2px 0}
.clock .date{font-size:.78rem; opacity:.85}
.clock .sky{font-size:1.4rem}

/* ---------- globe / distance ---------- */
#map{width:100%; max-width:320px; aspect-ratio:1; margin:0 auto; display:block}
#map svg{overflow:visible}
.dist{font-weight:700; margin:.9rem 0 0}

/* ---------- weather ---------- */
.weather{display:grid; grid-template-columns:1fr 1fr; gap:12px}
.wx{background:var(--bg); border:1px solid var(--line); border-radius:14px; padding:14px; text-align:center}
.wx .icon{font-size:2rem}
.wx .temp{font-family:Fraunces,serif; font-weight:700; font-size:1.5rem}
.wx .city{font-size:.82rem; color:var(--muted)}
.wx .desc{font-size:.8rem; color:var(--muted)}
.fx{font-family:Fraunces,serif; font-size:1.15rem; font-weight:600; margin:0}
.fx small{display:block; font-family:Nunito; font-size:.8rem; color:var(--muted); font-weight:400; margin-top:4px}

/* ---------- pregnancy ---------- */
#preg .wk{font-family:Fraunces,serif; font-weight:700; font-size:1.6rem}
#preg .size{margin:.3rem 0 .8rem}
#preg .tri{display:flex; gap:6px; margin-bottom:10px}
#preg .tri span{flex:1; text-align:center; font-size:.72rem; padding:6px 4px; border-radius:8px; background:var(--bg); border:1px solid var(--line); color:var(--muted)}
#preg .tri span.on{background:var(--rose); color:#fff; border-color:var(--rose)}

/* ---------- ping ---------- */
.ping-card{text-align:center}
.ping-btn{
  border:none; cursor:pointer; color:#fff; font:inherit; font-weight:700;
  background:linear-gradient(150deg,var(--rose),var(--rose-deep));
  border-radius:999px; padding:16px 26px; font-size:1.1rem;
  display:inline-flex; gap:10px; align-items:center; box-shadow:var(--shadow);
  transition:transform .1s;
}
.ping-btn:active{transform:scale(.94)}
.ping-btn span{font-size:.95rem}
.heart-fly{position:fixed; pointer-events:none; font-size:1.5rem; animation:fly 1s ease-out forwards; z-index:50}
@keyframes fly{to{transform:translateY(-120px) scale(1.6); opacity:0}}

/* ---------- notes ---------- */
textarea,input{
  font:inherit; color:var(--ink); background:var(--card);
  border:1px solid var(--line); border-radius:12px; padding:10px 12px; width:100%;
}
textarea{resize:vertical}
form{margin-bottom:12px}
.field{display:flex; gap:10px; align-items:center; margin-top:10px}
.field.wrap{flex-wrap:wrap}
.field label{display:flex; gap:6px; align-items:center; white-space:nowrap}
.field input[type=date]{width:auto}
.emoji-in{width:56px; text-align:center}
.row{display:flex; gap:10px; align-items:center}
.row.between{justify-content:space-between}
.row.wrap{flex-wrap:wrap}
.btn{
  border:1px solid var(--line); background:var(--card); color:var(--ink);
  border-radius:12px; padding:10px 16px; font:inherit; font-weight:700; cursor:pointer;
}
.btn.primary{background:var(--rose); color:#fff; border-color:var(--rose)}
.btn.ghost{background:none; color:var(--muted)}
.btn.big{font-size:1.05rem; padding:12px 22px}
.btn.upload{display:inline-block; text-align:center}
.note-list{display:flex; flex-direction:column; gap:10px}
.note{background:var(--bg); border:1px solid var(--line); border-radius:14px; padding:12px 14px}
.note .meta{font-size:.75rem; color:var(--muted); display:flex; justify-content:space-between; margin-bottom:4px}
.note.sealed{opacity:.85; font-style:italic; color:var(--muted)}
.note .body{white-space:pre-wrap}

/* ---------- photos ---------- */
.photo-grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(96px,1fr)); gap:8px; margin-top:12px}
.photo-grid img{width:100%; aspect-ratio:1; object-fit:cover; border-radius:12px; cursor:pointer; border:1px solid var(--line)}
.ph{position:relative}
.ph-del{
  position:absolute; top:5px; right:5px; width:24px; height:24px; border-radius:50%;
  border:none; cursor:pointer; background:rgba(20,10,10,.62); color:#fff;
  font-size:.75rem; line-height:1; display:flex; align-items:center; justify-content:center;
  opacity:0; transition:opacity .15s;
}
.ph:hover .ph-del, .ph-del:focus{opacity:1}
@media (hover:none){ .ph-del{opacity:1} }
#memoryOfDay{margin-bottom:12px}
#memoryOfDay img{width:100%; border-radius:16px; border:1px solid var(--line)}
#memoryOfDay .ph-del{opacity:1; width:28px; height:28px; top:8px; right:8px; font-size:.85rem}
#memoryOfDay .cap{font-size:.85rem; color:var(--muted); margin-top:6px; text-align:center}
#lbImg{width:100%; border-radius:12px; margin-bottom:10px}

/* ---------- checklist ---------- */
.cl-group h3{margin-top:16px}
.cl-item{display:flex; gap:10px; align-items:center; padding:8px 0; border-bottom:1px dashed var(--line)}
.cl-item input[type=checkbox]{width:20px; height:20px; accent-color:var(--rose); flex:0 0 auto}
.cl-item .lbl{flex:1}
.cl-item.done .lbl{text-decoration:line-through; color:var(--muted)}
.cl-add{display:flex; gap:8px; margin-top:8px}

/* ---------- wishes ---------- */
.wish-list{display:flex; flex-direction:column; gap:10px}
.wish{background:var(--bg); border:1px solid var(--line); border-left:4px solid var(--gold); border-radius:12px; padding:12px 14px}
.wish .from{font-weight:700; font-size:.85rem; color:var(--rose-deep)}
.wish .msg{white-space:pre-wrap; margin-top:2px}

/* ---------- kicks / contractions ---------- */
.mini-history{margin-top:12px; display:flex; flex-direction:column; gap:6px}
.mini-history .h-row{display:flex; justify-content:space-between; font-size:.85rem; background:var(--bg); border:1px solid var(--line); border-radius:10px; padding:8px 12px}
#kickLive,.con-stats{font-family:Fraunces,serif; font-weight:600; margin-bottom:12px}
#kickLive .big-n,.con-stats .big-n{font-size:1.6rem; color:var(--rose-deep)}
.live-dot{color:var(--rose); animation:pulse 1.2s infinite}
@keyframes pulse{50%{opacity:.3}}

/* ---------- modal ---------- */
.modal{position:fixed; inset:0; z-index:60; display:flex; align-items:center; justify-content:center;
  background:rgba(30,15,15,.5); padding:18px; backdrop-filter:blur(3px)}
.modal[hidden]{display:none}
.modal-card{background:var(--card); border-radius:20px; padding:24px; width:100%; max-width:420px; box-shadow:var(--shadow); max-height:90vh; overflow:auto}
.modal-card.wide{max-width:520px}
.pin-input{font-size:1.8rem; text-align:center; letter-spacing:.5rem; margin:14px 0}
.setrow{display:flex; justify-content:space-between; align-items:center; gap:12px; margin:8px 0; font-size:.9rem}
.setrow input{width:auto}

/* ---------- toast ---------- */
.toast{position:fixed; left:50%; bottom:24px; transform:translateX(-50%);
  background:var(--ink); color:var(--bg); padding:12px 18px; border-radius:999px;
  font-size:.9rem; z-index:70; box-shadow:var(--shadow)}
.toast[hidden]{display:none}

footer{text-align:center; color:var(--muted); font-size:.82rem; padding:24px}

@media (max-width:520px){
  .clocks,.weather{grid-template-columns:1fr}
}
