:root {
  --bg: #0e0f1a;
  --card: rgba(26, 29, 47, 0.86);
  --card-2: rgba(35, 39, 62, 0.7);
  --text: #eef0ff;
  --muted: #9298b8;
  --line: rgba(255, 255, 255, 0.08);
  --accent: #8b6bff;
  --radius: 20px;
}

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

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

body {
  position: relative;
  overflow-x: hidden;
  padding: calc(18px + env(safe-area-inset-top)) 16px calc(28px + env(safe-area-inset-bottom));
}

.glow {
  position: fixed;
  width: 60vw;
  height: 60vw;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}
.glow-a { top: -24vw; left: -18vw; background: #5b3dff; }
.glow-b { bottom: -30vw; right: -22vw; background: #0f7f74; opacity: 0.22; }

#app { position: relative; z-index: 1; max-width: 520px; margin: 0 auto; }

.top { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 20px; }
.brand { font-size: 17px; font-weight: 650; letter-spacing: 0.4px; }
.mark { color: var(--accent); margin-right: 6px; }
.date { font-size: 13px; color: var(--muted); }

.hero {
  background: linear-gradient(160deg, rgba(60, 52, 120, 0.55), rgba(24, 27, 44, 0.9));
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 20px;
  margin-bottom: 18px;
}
.hero-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.hero-num { font-size: 42px; font-weight: 300; line-height: 1; letter-spacing: -1px; }
.hero-num .of { font-size: 20px; color: var(--muted); font-weight: 400; }
.hero-label { color: var(--muted); font-size: 13px; margin-top: 6px; }

.ring {
  width: 62px; height: 62px; flex: 0 0 62px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; color: var(--text);
  background:
    radial-gradient(closest-side, #191c2e 78%, transparent 79%),
    conic-gradient(var(--accent) calc(var(--p, 0) * 1%), rgba(255, 255, 255, 0.1) 0);
  transition: --p 0.4s ease;
}

.bar { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); margin-top: 16px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #8b6bff, #4ad4c0); transition: width 0.45s ease; }
.week-note { margin-top: 12px; font-size: 12px; color: var(--muted); }

.habits { display: flex; flex-direction: column; gap: 10px; }

.card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 14px 14px 12px;
  transition: transform 0.12s ease, border-color 0.2s ease;
}
.card:active { transform: scale(0.99); }
.card.done { border-color: rgba(255, 255, 255, 0.22); border-color: color-mix(in srgb, var(--c) 45%, transparent); }

.check {
  width: 46px; height: 46px; flex: 0 0 46px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  border-color: color-mix(in srgb, var(--c) 55%, transparent);
  background: transparent;
  color: transparent;
  font-size: 20px;
  cursor: pointer;
  display: grid; place-items: center;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}
.check:active { transform: scale(0.9); }
.check.on {
  background: var(--c);
  border-color: var(--c);
  color: #0e0f1a;
  box-shadow: 0 0 22px color-mix(in srgb, var(--c) 45%, transparent);
}

.card .body { flex: 1; min-width: 0; }
.card .name { font-size: 15px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .name .emoji { margin-right: 5px; }
.card .meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.card .meta .flame { color: #ffb057; }

.dots { display: flex; gap: 5px; margin-top: 8px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, 0.1); }
.dot.on { background: var(--c); }

.del {
  position: absolute; top: 6px; right: 8px;
  background: none; border: none; color: var(--muted);
  font-size: 16px; line-height: 1; padding: 4px 6px;
  opacity: 0.35; cursor: pointer;
}
.del:active { opacity: 1; color: #ff7a7a; }

.empty { text-align: center; padding: 26px 18px 8px; color: var(--muted); }
.empty-icon { font-size: 34px; }
.empty h2 { font-size: 17px; color: var(--text); margin: 10px 0 6px; font-weight: 550; }
.empty p { margin: 0 auto; max-width: 260px; font-size: 13px; line-height: 1.5; }

button { font-family: inherit; }

.ghost {
  width: 100%;
  margin-top: 14px;
  padding: 15px;
  border-radius: var(--radius);
  border: 1px dashed rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
}
.ghost span { color: var(--accent); font-size: 18px; margin-right: 6px; }
.ghost:active { background: rgba(255, 255, 255, 0.07); }

.sheet {
  margin-top: 12px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  animation: rise 0.18s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.field-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 8px; }

input[type="text"], input[type="time"] {
  width: 100%;
  background: rgba(10, 11, 20, 0.6);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  padding: 13px 14px;
  outline: none;
}
input[type="text"]:focus { border-color: rgba(139, 107, 255, 0.6); }
input[type="time"] { width: 116px; flex: 0 0 116px; text-align: center; }
input[type="time"]::-webkit-calendar-picker-indicator { filter: invert(0.8); }

.pick-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pick {
  width: 40px; height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  font-size: 19px;
  cursor: pointer;
  display: grid; place-items: center;
}
.pick.sel { border-color: var(--accent); background: rgba(139, 107, 255, 0.18); }
.colors .pick { border-radius: 50%; }
.colors .pick.sel { border-color: #fff; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25); }

.primary {
  width: 100%;
  margin-top: 16px;
  padding: 14px;
  border-radius: 15px;
  border: none;
  background: linear-gradient(120deg, #8b6bff, #6a4bff);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.primary:active { filter: brightness(0.9); }

.settings {
  margin-top: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.setting-title { font-size: 14px; font-weight: 550; }
.setting-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.setting-actions { display: flex; gap: 8px; margin-top: 14px; }
.small {
  flex: 1;
  padding: 11px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}
.small.quiet { background: transparent; }
.small:active { background: rgba(255, 255, 255, 0.12); }

.foot { text-align: center; color: rgba(146, 152, 184, 0.6); font-size: 11px; margin-top: 22px; letter-spacing: 0.3px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  background: rgba(30, 33, 52, 0.96);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 10;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.skeleton { height: 76px; border-radius: var(--radius); background: rgba(255, 255, 255, 0.04); }
