:root {
  --pink: #ff6fa5; --purple: #9b5de5; --blue: #4ea8de; --green: #43c59e;
  --orange: #ff9e44; --yellow: #ffd23f; --red: #ff5d73; --ink: #3a3550;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  color: var(--ink); min-height: 100vh;
  background: linear-gradient(135deg, #ffe4ee 0%, #e7f0ff 50%, #fff3e0 100%) fixed;
  -webkit-font-smoothing: antialiased;
}
main { max-width: 480px; margin: 0 auto; padding: 18px 16px 48px; }
.loader { text-align: center; padding: 70px 0; color: var(--purple); font-size: 18px; }
.hidden { display: none !important; }

h1 { font-size: 26px; text-align: center; color: var(--purple); margin: 6px 0 2px; font-weight: 800; }
.sub { text-align: center; color: #8a86a0; margin: 0 0 18px; font-size: 15px; }
.back { background: #fff; border: 0; border-radius: 50%; width: 46px; height: 46px; font-size: 22px;
  box-shadow: 0 6px 16px rgba(0,0,0,.1); cursor: pointer; color: var(--purple); margin-bottom: 14px; }

.card { background: rgba(255,255,255,.88); border-radius: 26px; padding: 22px; position: relative;
  box-shadow: 0 12px 30px rgba(155,93,229,.15); border: 3px solid rgba(255,111,165,.18); }

.score { text-align: center; }
.num { font-size: 86px; font-weight: 800; color: var(--purple); line-height: 1; margin: 2px 0 8px; }
.num.bump { animation: bump .5s; }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }
.stars { display: flex; justify-content: center; gap: 6px; margin-bottom: 6px; }
.star { font-size: 42px; filter: grayscale(1) opacity(.35); transition: filter .3s; }
.star.on { filter: none; }
.star.pop { animation: pop .6s ease; }
@keyframes pop { 0% { transform: scale(1) rotate(0); } 40% { transform: scale(1.4) rotate(12deg); } 100% { transform: scale(1) rotate(0); } }
.crown { min-height: 26px; font-size: 20px; font-weight: 800; color: var(--purple); margin-top: 6px; }
.refresh { position: absolute; top: 14px; right: 14px; width: 38px; height: 38px; border: 0; border-radius: 50%;
  background: var(--blue); color: #fff; font-size: 17px; cursor: pointer; box-shadow: 0 4px 10px rgba(78,168,222,.4); }
.refresh.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.pm { display: flex; justify-content: center; gap: 30px; margin: 22px 0; }
.rbtn { border: 0; width: 88px; height: 64px; border-radius: 34px; font-size: 34px; font-weight: 800; color: #fff;
  cursor: pointer; box-shadow: 0 10px 22px rgba(0,0,0,.15); transition: transform .12s; }
.rbtn:active { transform: scale(.9); }
.rbtn:disabled { opacity: .45; }
.minus { background: linear-gradient(135deg, var(--pink), var(--red)); }
.plus { background: linear-gradient(135deg, var(--green), var(--blue)); }

.nav { display: flex; flex-direction: column; gap: 12px; }
.nav button { border: 0; color: #fff; font-size: 17px; font-weight: 700; padding: 16px; border-radius: 18px;
  cursor: pointer; box-shadow: 0 8px 18px rgba(0,0,0,.12); transition: transform .12s; }
.nav button:active { transform: scale(.97); }
.n1 { background: linear-gradient(135deg, var(--blue), var(--green)); }
.n2 { background: linear-gradient(135deg, var(--yellow), var(--orange)); }
.n3 { background: linear-gradient(135deg, var(--purple), var(--pink)); }
.n4 { background: linear-gradient(135deg, var(--orange), var(--yellow)); }

.item { background: #fff; border-radius: 18px; padding: 14px; margin-bottom: 12px; display: flex; align-items: center;
  gap: 14px; box-shadow: 0 6px 16px rgba(0,0,0,.07); animation: rise .3s both; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.item.done { opacity: .7; }
.chk { flex: 0 0 auto; width: 46px; height: 46px; border-radius: 14px; border: 3px dashed #cbd0e0; background: #fff;
  font-size: 24px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.chk.on { background: linear-gradient(135deg, var(--blue), #2f7ec4); color: #fff; border: 0; }
.ti { flex: 1; min-width: 0; }
.ti h3 { margin: 0; font-size: 17px; }
.ti.done h3 { text-decoration: line-through; color: #9a96ad; }
.ti p { margin: 3px 0 0; font-size: 13px; color: #8a86a0; }
.badge { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center;
  justify-content: center; font-size: 18px; background: #f0f0f5; color: #bbb; }
.badge.appr { background: linear-gradient(135deg, var(--green), #2faa83); color: #fff; }
.badge.wait { background: #fff0d6; color: var(--orange); font-weight: 800; }

.sec { font-size: 18px; font-weight: 800; margin: 18px 0 10px; }
.empty { text-align: center; color: #9a96ad; padding: 18px; background: rgba(255,255,255,.6); border-radius: 16px; }

.st { border-radius: 18px; padding: 14px; margin-bottom: 12px; box-shadow: 0 6px 16px rgba(0,0,0,.07); animation: rise .3s both; }
.st.avail { background: linear-gradient(135deg, #fff6d6, #ffe9c2); }
.st.prog { background: linear-gradient(135deg, #ffe2d0, #ffd5d5); }
.st.rew { background: linear-gradient(135deg, #d6f5e6, #c6efda); }
.st.pen { background: linear-gradient(135deg, #ffd9df, #ffc9d2); }
.st h3 { margin: 0 0 4px; font-size: 17px; }
.st p { margin: 0 0 8px; font-size: 13px; color: #6a6680; }
.st .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.rew { color: var(--orange); font-weight: 800; }
.abtn { border: 0; color: #fff; font-weight: 700; padding: 9px 16px; border-radius: 13px; cursor: pointer; font-size: 14px; }
.abtn:active { transform: scale(.95); }
.a-take { background: linear-gradient(135deg, var(--yellow), var(--orange)); }
.a-done { background: linear-gradient(135deg, var(--green), #2faa83); }
.a-rev { background: var(--orange); }
.tag { font-size: 12px; padding: 4px 10px; border-radius: 10px; background: #fff; font-weight: 700; }

input, textarea, select { width: 100%; border: 2px solid #e3e3ee; border-radius: 13px; padding: 12px; font-size: 15px;
  font-family: inherit; margin-bottom: 10px; background: #fff; }
input:focus, textarea:focus { outline: none; border-color: var(--purple); }
.pbtn { width: 100%; border: 0; color: #fff; font-weight: 700; padding: 14px; border-radius: 14px; font-size: 16px; cursor: pointer; }
.pbtn:active { transform: scale(.98); }
.pbtn.add { background: linear-gradient(135deg, var(--orange), var(--yellow)); }
.pbtn.danger { background: linear-gradient(135deg, var(--red), var(--pink)); }
.del { background: 0; border: 0; color: var(--red); font-size: 22px; cursor: pointer; padding: 4px 8px; }

.mask { position: fixed; inset: 0; background: rgba(40,30,60,.55); display: flex; align-items: center;
  justify-content: center; z-index: 50; padding: 18px; }
.modal { background: #fff; border-radius: 24px; padding: 24px; max-width: 360px; width: 100%;
  box-shadow: 0 20px 50px rgba(0,0,0,.3); animation: rise .25s both; }
.modal h3 { margin: 0 0 14px; text-align: center; color: var(--purple); font-size: 20px; }
.modal .err { color: var(--red); text-align: center; font-weight: 700; margin: 0 0 10px; min-height: 20px; }
.who { display: flex; gap: 10px; }
.who button { flex: 1; border: 0; color: #fff; font-weight: 700; padding: 14px; border-radius: 14px; font-size: 16px; cursor: pointer; }
.k { background: linear-gradient(135deg, var(--pink), var(--purple)); }
.s { background: linear-gradient(135deg, var(--blue), var(--green)); }
.ghost { width: 100%; margin-top: 10px; background: #ececf3; color: #666; border: 0; padding: 12px; border-radius: 13px; font-size: 15px; cursor: pointer; }

.h { background: rgba(255,111,165,.08); border-radius: 13px; padding: 11px; margin-bottom: 9px; }
.h-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.h-d { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 14px; }
.h-d.up { background: var(--green); } .h-d.down { background: var(--pink); }
.h-reason { font-size: 13px; color: #6a6680; margin-top: 6px; background: rgba(255,255,255,.6); padding: 7px; border-radius: 9px; }

#fx { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.heart { position: absolute; bottom: -30px; font-size: 22px; animation: fly linear forwards; }
@keyframes fly { to { transform: translateY(-110vh) rotate(720deg); opacity: 0; } }

.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 12px 18px; border-radius: 14px; z-index: 70; font-size: 14px; max-width: 90%; text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,.3); animation: rise .25s both; }
