:root{
  --bg0:#fff3f9;
  --bg1:#ffe0f1;
  --card: rgba(255,255,255,.82);
  --card2: rgba(255,255,255,.62);
  --text:#201623;
  --muted:#6c5a6d;
  --line:rgba(64,16,48,.10);
  --accent:#ff4fa3;
  --accent2:#ff86c5;
  --warn:#ffb3d9;
  --bad:#ff4d6d;
  --shadow: 0 16px 40px rgba(65,10,44,.16);
  --radius: 16px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  color:var(--text);
  background:
    radial-gradient(1200px 650px at 18% -10%, rgba(255,79,163,.28), transparent 56%),
    radial-gradient(900px 520px at 92% 8%, rgba(255,179,217,.28), transparent 58%),
    radial-gradient(900px 520px at 50% 112%, rgba(255,134,197,.18), transparent 55%),
    linear-gradient(180deg, var(--bg0), var(--bg1) 70%, #fff 110%);
  font-family: ui-rounded, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, -apple-system, Segoe UI, Roboto, "Noto Sans", Arial;
  position: relative;
  overflow-x: hidden;
}

body::before{
  content:"";
  position: fixed;
  inset: -18% -22%;
  pointer-events:none;
  z-index: 0;
  background:
    radial-gradient(700px 420px at 10% 20%, rgba(255,79,163,.26), transparent 62%),
    radial-gradient(900px 520px at 95% 30%, rgba(255,134,197,.22), transparent 60%),
    radial-gradient(900px 520px at 40% 95%, rgba(255,179,217,.16), transparent 62%),
    conic-gradient(from 0deg at 50% 50%, rgba(255,79,163,.10), rgba(255,255,255,0), rgba(255,134,197,.10), rgba(255,255,255,0), rgba(255,179,217,.10));
  filter: blur(18px) saturate(112%);
  opacity: .55;
  transform: translate3d(0,0,0);
  animation: glowDrift 18s ease-in-out infinite alternate;
}

body::after{
  content:"";
  position: fixed;
  inset: 0;
  pointer-events:none;
  z-index: 0;
  background:
    radial-gradient(1px 1px at 12% 18%, rgba(255,79,163,.35), transparent 55%),
    radial-gradient(1px 1px at 82% 26%, rgba(255,134,197,.30), transparent 55%),
    radial-gradient(1px 1px at 36% 78%, rgba(255,179,217,.26), transparent 55%),
    radial-gradient(1px 1px at 64% 62%, rgba(255,255,255,.22), transparent 55%);
  opacity: .28;
  filter: blur(.2px);
  mix-blend-mode: soft-light;
  animation: sparkleDrift 26s linear infinite;
}

@keyframes glowDrift{
  0%{ transform: translate3d(-1.5%, -1.5%, 0) rotate(-1deg) scale(1.00); }
  50%{ transform: translate3d(1.2%, -0.6%, 0) rotate(1deg) scale(1.02); }
  100%{ transform: translate3d(0.6%, 1.4%, 0) rotate(0deg) scale(1.01); }
}
@keyframes sparkleDrift{
  0%{ transform: translate3d(0,0,0); }
  100%{ transform: translate3d(-2.5%, 1.5%, 0); }
}

.app{
  min-height:100%;
  display:flex;
  flex-direction:column;
  position: relative;
  z-index: 1;
}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:14px 18px;
  border-bottom:1px solid var(--line);
  background: rgba(255,255,255,.55);
  backdrop-filter: blur(10px);
  position:sticky;
  top:0;
  z-index:10;
}

.brand{ display:flex; align-items:center; gap:12px; }
.brand__mark{
  width:40px; height:40px;
  display:grid; place-items:center;
  border-radius:12px;
  background: linear-gradient(135deg, rgba(255,79,163,.22), rgba(255,179,217,.18));
  border:1px solid rgba(255,79,163,.22);
  font-weight:800;
  letter-spacing:.8px;
}
.brand__title{ font-weight:800; letter-spacing:.2px; }
.brand__sub{ color:var(--muted); font-size:12px; margin-top:2px; }

.nav{ display:flex; gap:10px; }
.nav__item{
  text-decoration:none;
  color:var(--muted);
  padding:10px 12px;
  border-radius:999px;
  border:1px solid transparent;
}
.nav__item:hover{
  color:var(--text);
  border-color: var(--line);
  background: rgba(255,255,255,.03);
}
.nav__item.is-active{
  color:var(--text);
  background: rgba(255,79,163,.12);
  border-color: rgba(255,79,163,.22);
}

.topbar__right{ display:flex; gap:10px; }

.btn{
  appearance:none;
  border:1px solid rgba(255,79,163,.30);
  background: linear-gradient(135deg, rgba(255,79,163,.18), rgba(255,179,217,.14));
  color:var(--text);
  padding:10px 12px;
  border-radius:12px;
  font-weight:650;
  cursor:pointer;
  transition: transform 160ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}
.btn:hover{ background: linear-gradient(135deg, rgba(255,79,163,.24), rgba(255,179,217,.18)); }
.btn:active{ transform: translateY(1px); }
.btn--ghost{
  border-color: var(--line);
  background: rgba(255,255,255,.45);
  color: var(--muted);
}
.btn--ghost:hover{ color:var(--text); background: rgba(255,255,255,.70); }

.main{
  width:min(1060px, calc(100% - 28px));
  margin:18px auto 40px;
  flex:1;
}

.pagehead{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:14px;
  margin-bottom:14px;
}
.pagehead__title{
  font-size:24px;
  font-weight:850;
  letter-spacing:.2px;
}
.pagehead__sub{ color:var(--muted); font-size:13px; margin-top:6px; }

.grid{
  display:grid;
  grid-template-columns: 1fr;
  gap:12px;
}

.card{
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,.86), rgba(255,255,255,.72));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 14px;
  transition: transform 200ms ease, box-shadow 220ms ease, background 220ms ease;
}
.card:hover{
  transform: translateY(-1px);
  box-shadow: 0 18px 44px rgba(65,10,44,.18);
}

@media (prefers-reduced-motion: reduce){
  body::before, body::after{ animation: none !important; }
  .btn, .card{ transition: none !important; }
}

.input{
  width:100%;
  border-radius:12px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.65);
  color: var(--text);
  padding:10px 12px;
  outline:none;
}
.input::placeholder{ color: rgba(159,176,199,.75); }
.input:focus{
  border-color: rgba(255,79,163,.30);
  box-shadow: 0 0 0 4px rgba(255,79,163,.12);
}

.row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.chip{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:6px 10px;
  border:1px solid var(--line);
  border-radius:999px;
  background: rgba(255,255,255,.60);
  color: var(--muted);
  font-size: 12px;
}

.badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:6px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:750;
  letter-spacing:.2px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.03);
  color: var(--muted);
}
.badge--hit{
  background: rgba(255,79,163,.12);
  border-color: rgba(255,79,163,.22);
  color: var(--text);
}
.badge--track{
  background: rgba(255,179,217,.22);
  border-color: rgba(255,179,217,.32);
  color: var(--text);
}
.badge--behind{
  background: rgba(255,77,109,.10);
  border-color: rgba(255,77,109,.22);
  color: var(--text);
}

.goal{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.goal__top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
}
.goal__name{
  font-weight:850;
  letter-spacing:.2px;
  display:flex;
  align-items:center;
  gap:10px;
}
.goal__icon{
  width:26px; height:26px;
  border-radius:10px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.60);
  display:grid; place-items:center;
  color: var(--muted);
  font-size: 13px;
}
.goal__meta{ color: var(--muted); font-size: 12px; margin-top:6px; }

.progress{
  border-radius:999px;
  height:10px;
  border:1px solid var(--line);
  background: rgba(0,0,0,.06);
  overflow:hidden;
}
.progress__bar{
  height:100%;
  width:0%;
  background: linear-gradient(90deg, rgba(255,79,163,.92), rgba(255,179,217,.55));
}

.goal__mid{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
}
.goal__big{
  font-size: 28px;
  font-weight: 900;
  letter-spacing:.2px;
}
.goal__big small{
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}

.goal__bottom{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:10px;
  padding-top:4px;
}
.btn--mini{
  padding:8px 10px;
  border-radius:12px;
}
.btn--danger{
  border-color: rgba(255,107,107,.25);
  background: rgba(255,107,107,.10);
}
.btn--danger:hover{ background: rgba(255,107,107,.14); }

.logs{
  margin-top:12px;
  border-top:1px solid var(--line);
  padding-top:12px;
}
.logs__toggle{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  color: var(--muted);
  cursor:pointer;
}
.logs__toggle:hover{ color: var(--text); background: rgba(255,255,255,.03); }
.logs__list{ margin-top:12px; display:flex; flex-direction:column; gap:10px; }
.logrow{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.55);
}
.logrow__left{ display:flex; flex-direction:column; gap:4px; }
.logrow__title{ font-weight:800; letter-spacing:.2px; }
.logrow__sub{ color: var(--muted); font-size: 12px; }
.logrow__right{ display:flex; gap:10px; }

/* Responsive: tablet */
@media (max-width: 980px){
  .topbar{ flex-wrap:wrap; }
  .topbar__right{ flex-wrap:wrap; justify-content:flex-end; }
  .nav{
    overflow-x:auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    padding-bottom: 2px;
  }
  .nav::-webkit-scrollbar{ height:0; }
}

/* Responsive: phone */
@media (max-width: 720px){
  .topbar{
    padding:10px 12px;
    gap:10px;
  }
  .brand__mark{ width:36px; height:36px; border-radius:14px; }
  .brand__sub{ display:none; }
  .brand__title{ font-size: 14px; }

  .topbar__right{ gap:8px; }
  #btnExport{ display:none; }

  .nav{
    position: fixed;
    left: 50%;
    bottom: calc(12px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    z-index: 40;
    background: rgba(255,255,255,.78);
    border: 1px solid rgba(255,79,163,.18);
    box-shadow: 0 18px 44px rgba(65,10,44,.18);
    backdrop-filter: blur(12px);
    padding: 6px;
    border-radius: 999px;
    max-width: calc(100% - 18px);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .nav__item{
    padding:10px 12px;
    font-size: 13px;
  }

  .main{
    width: calc(100% - 18px);
    margin: 14px auto calc(96px + env(safe-area-inset-bottom));
  }
  .footer{ display:none; }

  .pagehead{
    flex-direction:column;
    align-items:flex-start;
  }
  .row{ flex-wrap:wrap; align-items:flex-start; }

  .goal__mid{
    flex-direction:column;
    align-items:stretch;
  }
  .goal__big{ font-size: 24px; }
  .goal__bottom{
    gap:10px;
  }
  .goal__bottom form{
    min-width: 100% !important;
  }

  .logrow{
    flex-direction:column;
    align-items:stretch;
    gap:10px;
  }
  .logrow__right{
    justify-content:flex-end;
    flex-wrap:wrap;
  }

  .dialog{
    width: calc(100% - 14px);
    max-height: calc(100vh - 24px);
  }
  .dialog__body{
    max-height: calc(100vh - 170px);
    overflow:auto;
  }
}

.dialog::backdrop{
  background: rgba(0,0,0,.55);
}
.dialog{
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,255,255,.82));
  color: var(--text);
  box-shadow: var(--shadow);
  width: min(760px, calc(100% - 22px));
}
.dialog__head{
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--line);
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}
.dialog__title{ font-weight:900; letter-spacing:.2px; font-size: 16px; }
.dialog__sub{ color: var(--muted); font-size: 12px; margin-top: 4px; }
.dialog__body{ padding: 14px; }
.dialog__foot{
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.stepper{ display:flex; gap:8px; flex-wrap:wrap; }
.step{
  padding:6px 10px;
  border:1px solid var(--line);
  border-radius:999px;
  background: rgba(255,255,255,.03);
  color: var(--muted);
  font-size: 12px;
}
.step.is-active{
  color: var(--text);
  background: rgba(255,79,163,.12);
  border-color: rgba(255,79,163,.25);
}
.formgrid{
  display:grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.formgrid--2{
  grid-template-columns: 1fr;
}
.label{
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.field{ display:flex; flex-direction:column; }
.select{
  width:100%;
  border-radius:12px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.65);
  color: var(--text);
  padding:10px 12px;
  outline:none;
}
.select:focus{
  border-color: rgba(255,79,163,.30);
  box-shadow: 0 0 0 4px rgba(255,79,163,.12);
}
.checkrow{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  padding: 10px 12px;
  border:1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.55);
}
.check{
  display:inline-flex;
  align-items:center;
  gap:8px;
  color: var(--muted);
  font-size: 12px;
}
.check input{ accent-color: var(--accent); }

.weekbar{
  display:grid;
  grid-template-columns: repeat(7, 1fr);
  gap:10px;
  margin-top:10px;
}
.daybox{
  border:1px solid var(--line);
  border-radius: 14px;
  padding:10px 10px;
  background: rgba(255,255,255,.02);
  color: var(--muted);
  min-height: 66px;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
}
.daybox__dow{ font-size: 12px; font-weight: 800; letter-spacing:.2px; }
.daybox__date{ font-size: 12px; }
.daybox--hit{
  background: rgba(255,79,163,.10);
  border-color: rgba(255,79,163,.20);
  color: var(--text);
}
.daybox--miss{
  background: rgba(255,255,255,.02);
  border-color: rgba(255,107,107,.20);
}
.daybox--rest{
  opacity: .6;
}

.chart{
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.55);
  overflow: hidden;
  position: relative;
}
.chart__canvas{
  width: 100%;
  display:block;
}
.chart__tip{
  position:absolute;
  max-width: 260px;
  padding: 10px 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.92);
  box-shadow: 0 16px 40px rgba(65,10,44,.18);
  backdrop-filter: blur(10px);
  pointer-events: none;
}
.chart__tipTitle{
  font-weight: 900;
  letter-spacing: .2px;
  font-size: 12px;
  margin-bottom: 8px;
}

/* Auth (Login/Register/Reset) */
.auth{
  display:grid;
  gap:12px;
}
.authCard{
  padding:0;
  overflow:hidden;
}
.authGrid{
  display:grid;
  grid-template-columns: 1.05fr 1fr;
}
.authHero{
  padding:22px 18px;
  background:
    radial-gradient(900px 380px at 18% 10%, rgba(255,79,163,.26), transparent 58%),
    radial-gradient(800px 380px at 85% 32%, rgba(255,134,197,.20), transparent 55%),
    linear-gradient(135deg, rgba(255,255,255,.72), rgba(255,255,255,.40));
  border-right:1px solid var(--line);
  position:relative;
}
.authHero::after{
  content:"";
  position:absolute;
  inset:0;
  background:
    linear-gradient(0deg, rgba(255,255,255,.30), transparent 45%),
    repeating-linear-gradient(135deg, rgba(255,79,163,.06) 0 10px, transparent 10px 22px);
  opacity:.55;
  pointer-events:none;
}
.authHeroInner{ position:relative; z-index:1; }
.authMark{
  width:56px; height:56px;
  display:grid; place-items:center;
  border-radius:18px;
  background: linear-gradient(135deg, rgba(255,79,163,.22), rgba(255,179,217,.18));
  border:1px solid rgba(255,79,163,.25);
  box-shadow: 0 14px 30px rgba(65,10,44,.14);
  font-weight:900;
  letter-spacing:1px;
}
.authTitle{
  font-size:28px;
  font-weight:950;
  letter-spacing:.2px;
  margin-top:14px;
}
.authTag{
  color: var(--muted);
  margin-top:8px;
  line-height:1.6;
}
.authBullets{
  margin-top:14px;
  display:flex;
  flex-direction:column;
  gap:10px;
}
.authBullet{
  display:flex;
  gap:10px;
  align-items:flex-start;
}
.authDot{
  width:10px; height:10px;
  border-radius:999px;
  background: rgba(255,79,163,.65);
  margin-top:6px;
  box-shadow: 0 0 0 4px rgba(255,79,163,.10);
}
.authForm{
  padding:18px;
}
.stepper--seg{
  background: rgba(255,255,255,.60);
  border:1px solid var(--line);
  border-radius: 999px;
  padding:6px;
  display:flex;
  gap:6px;
  flex-wrap:nowrap;
  overflow:auto;
}
.stepper--seg .step{
  border:none;
  background: transparent;
  padding:8px 12px;
  cursor:pointer;
  font-weight:800;
  white-space:nowrap;
}
.stepper--seg .step.is-active{
  background: rgba(255,79,163,.14);
  border:1px solid rgba(255,79,163,.22);
}
.authActions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
  margin-top:12px;
}
.authHelp{
  display:flex;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
  margin-top:10px;
  color: var(--muted);
  font-size:12px;
}

@media (max-width: 860px){
  .authGrid{ grid-template-columns: 1fr; }
  .authHero{ border-right:none; border-bottom:1px solid var(--line); }
}

/* Stickers */
.stickerBtn{
  display:inline-flex;
  align-items:center;
  gap:10px;
  padding:8px 10px;
  border:1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.65);
  cursor:pointer;
  text-decoration:none;
  color: var(--text);
}
.stickerBtn:hover{
  background: rgba(255,255,255,.82);
  border-color: rgba(255,79,163,.20);
}
.stickerImg{
  width:54px;
  height:54px;
  object-fit:contain;
  border-radius: 16px;
  background: rgba(255,255,255,.70);
  border:1px solid var(--line);
  box-shadow: 0 14px 30px rgba(65,10,44,.10);
}
.stickerImg--sm{
  width:38px;
  height:38px;
  border-radius: 14px;
  box-shadow: none;
}
.stickerGrid{
  display:grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap:10px;
}
.stickerItem{
  display:flex;
  flex-direction:column;
  gap:8px;
  padding:10px;
  border:1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.60);
  cursor:pointer;
}
.stickerItem:hover{
  background: rgba(255,255,255,.82);
  border-color: rgba(255,79,163,.22);
}
.stickerItem.is-active{
  border-color: rgba(255,79,163,.35);
  box-shadow: 0 0 0 4px rgba(255,79,163,.10);
}
.stickerName{
  font-size:12px;
  color: var(--muted);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

@media (max-width: 860px){
  .stickerGrid{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.chart__tipRow{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  font-size: 12px;
  line-height: 1.3;
}
.chart__tipPill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  color: var(--text);
  font-weight: 850;
}
.chart__tipPill.is-hit{
  border-color: rgba(73,220,177,.25);
  background: rgba(73,220,177,.12);
}
.chart__tipPill.is-warn{
  border-color: rgba(255,204,102,.25);
  background: rgba(255,204,102,.10);
}

.muted{ color: var(--muted); }
.kbd{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255,255,255,.03);
}

.footer{
  padding:14px 18px;
  border-top:1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

@media (min-width: 860px){
  .grid{ grid-template-columns: 1.2fr .8fr; }
  .formgrid--2{ grid-template-columns: 1fr 1fr; }
}

@media (max-width: 700px){
  .topbar{ flex-wrap:wrap; }
  .nav{ width:100%; order:10; }
  .topbar__right{ width:100%; justify-content:flex-end; }
}
