:root {
  --bg: #14141a;
  --bg-raised: #1d1d26;
  --border: #2c2c38;
  --text: #e8e8ee;
  --text-dim: #94949f;
  --accent: #6ea8fe;
  --accent-dim: #3a5a8c;
  --good: #5fbf8f;
  --warn: #d98c4a;
  --danger: #d9634a;
  --radius: 12px;
  --pink: #ff6ec7;
  --gold: #ffd166;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.screen {
  padding: 1.5rem 1.25rem calc(2rem + env(safe-area-inset-bottom));
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.center-screen {
  justify-content: center;
  align-items: center;
  text-align: center;
  color: var(--text-dim);
}

.auth-screen {
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 0.85rem;
}

.auth-screen .field { width: 100%; }

.logo-mark {
  width: 5.5rem;
  height: 5.5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--pink));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.75rem;
  box-shadow: 0 6px 24px rgba(110, 168, 254, 0.35);
  margin-bottom: 0.5rem;
}

h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-size: 1.3rem; }
h2 { font-size: 1.1rem; color: var(--text-dim); font-weight: 500; }

p { margin: 0; line-height: 1.5; }

.muted { color: var(--text-dim); font-size: 0.9rem; }

/* Buttons */
button {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: var(--radius);
  transition: transform 0.1s ease;
}

button:active { transform: scale(0.94); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--pink));
  color: #0b0b10;
  font-weight: 700;
  padding: 0.9rem 1rem;
  font-size: 1rem;
  width: 100%;
  box-shadow: 0 4px 16px rgba(110, 168, 254, 0.25);
}

.btn-primary:disabled { opacity: 0.5; box-shadow: none; }

.btn-secondary {
  background: var(--bg-raised);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.9rem 1rem;
  font-size: 1rem;
  width: 100%;
}

.btn-text {
  background: none;
  color: var(--text-dim);
  padding: 0.5rem;
  font-size: 0.9rem;
  text-decoration: underline;
}

.btn-danger-text {
  background: none;
  color: var(--danger);
  padding: 0.5rem;
  font-size: 0.9rem;
}

/* Inputs */
input[type="password"], input[type="text"], input[type="number"], textarea, select {
  font: inherit;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.75rem;
  width: 100%;
}

textarea { resize: vertical; min-height: 4.5rem; }

.field { display: flex; flex-direction: column; gap: 0.5rem; }
.field label, .field-label { font-size: 0.95rem; color: var(--text); font-weight: 500; }

.field-hint {
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.4;
}

.error-msg {
  color: var(--danger);
  font-size: 0.9rem;
  min-height: 1.2em;
}

/* Home cards */
.card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: left;
  width: 100%;
}

.home-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.square-card {
  aspect-ratio: 1;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.4rem;
}

.square-card-icon { font-size: 2rem; }

.calendar-card, .mood-chart-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.month-title {
  font-size: 0.9rem;
  color: var(--text-dim);
  font-weight: 600;
  text-align: center;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.2rem;
}

.cal-dow {
  font-size: 0.65rem;
  color: var(--text-dim);
  text-align: center;
  padding-bottom: 0.2rem;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border-radius: 50%;
}

.cal-day.today { box-shadow: 0 0 0 2px var(--gold); border-radius: 50%; }

.cal-dot {
  position: absolute;
  border-radius: 50%;
}

.cal-day-num {
  position: relative;
  z-index: 1;
  font-size: 0.7rem;
}

.mood-chart-card svg { display: block; }

.card-status {
  font-size: 0.8rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  display: inline-block;
  width: fit-content;
}
.card-status.done { background: rgba(95,191,143,0.15); color: var(--good); }
.card-status.pending { background: rgba(217,140,74,0.15); color: var(--warn); }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Dot scale - colorful dial */
.dots {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.dot {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text-dim);
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  transition: transform 0.15s cubic-bezier(.34,1.56,.64,1), background 0.15s ease;
}

.dot.active {
  background: hsl(var(--hue, 200), 75%, 60%);
  border-color: transparent;
  color: #0b0b10;
  transform: scale(1.15);
  box-shadow: 0 0 10px hsl(var(--hue, 200), 75%, 55%);
}

/* Chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text);
  font-size: 0.9rem;
  transition: transform 0.15s cubic-bezier(.34,1.56,.64,1), background 0.15s ease;
}

.chip.active {
  background: linear-gradient(135deg, var(--accent-dim), var(--accent));
  border-color: var(--accent);
  color: #fff;
  transform: scale(1.06);
  box-shadow: 0 2px 10px rgba(110, 168, 254, 0.3);
}

.chip-group-label {
  font-size: 0.8rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 0.5rem;
}

/* Slider */
.slider-row { display: flex; flex-direction: column; gap: 0.4rem; }
.slider-value { font-size: 1.4rem; font-weight: 700; background: linear-gradient(135deg, var(--accent), var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent; }
input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  height: 1.5rem;
}
.slider-endpoints {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* Toggle */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  width: 100%;
}

.switch {
  width: 3rem;
  height: 1.75rem;
  border-radius: 999px;
  background: var(--border);
  position: relative;
  flex: 0 0 auto;
  transition: background 0.15s ease;
}

.switch.on { background: linear-gradient(135deg, var(--accent-dim), var(--accent)); }

.switch-knob {
  position: absolute;
  top: 0.15rem;
  left: 0.15rem;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 50%;
  background: var(--text-dim);
  transition: left 0.15s cubic-bezier(.34,1.56,.64,1);
}

.switch.on .switch-knob {
  left: calc(100% - 1.6rem);
  background: #fff;
}

.form-scroll {
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding-bottom: 1rem;
}

.sticky-footer {
  position: sticky;
  bottom: 0;
  background: var(--bg);
  padding-top: 0.75rem;
  display: flex;
  gap: 0.75rem;
}

.history-item {
  display: flex;
  justify-content: space-between;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.history-item:last-child { border-bottom: none; }

/* Wizard progress dots */
.wizard-progress {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.wizard-progress-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--border);
  flex: 0 0 auto;
}

.wizard-progress-dot.done { background: linear-gradient(135deg, var(--accent), var(--pink)); }
.wizard-progress-dot.current { background: var(--gold); width: 0.7rem; height: 0.7rem; }

.wizard-step-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.wizard-step-icon { font-size: 1.6rem; }

.wizard-step-count {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.wizard-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-cancel {
  background: none;
  color: var(--danger);
  padding: 0.4rem 0.7rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.btn-secondary:disabled {
  opacity: 0.35;
}

.wizard-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  overflow-y: auto;
}

/* Sparkle celebration */
.sparkle-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 999;
}

.sparkle-particle {
  position: absolute;
  font-size: 1.8rem;
  animation: sparkle-pop 0.9s ease-out forwards;
}

@keyframes sparkle-pop {
  0% { opacity: 0; transform: translate(0, 0) scale(0.3) rotate(0deg); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: var(--end-transform); }
}

.sparkle-check {
  font-size: 3rem;
  animation: sparkle-check-in 0.5s cubic-bezier(.34,1.56,.64,1);
}

@keyframes sparkle-check-in {
  0% { opacity: 0; transform: scale(0.4); }
  100% { opacity: 1; transform: scale(1); }
}
