/* onboarding.css — first-run wizard. Restrained motion, one idea per step. */

#onboarding {
  position: fixed;
  inset: 0;
  z-index: 60;
  background:
    radial-gradient(1000px 500px at 50% -10%, rgba(34, 211, 238, 0.08), transparent 60%),
    var(--bg);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
#onboarding[hidden] { display: none; }
body.ob-open { overflow: hidden; }

.ob-shell {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 20px 48px;
  max-width: 600px;
  margin: 0 auto;
}

.ob-progress {
  width: 100%;
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}
.ob-progress[hidden] { display: none; }
.ob-seg {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: var(--line-soft);
  overflow: hidden;
  position: relative;
}
.ob-seg.is-done { background: var(--cyan); }
.ob-seg.is-now::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--cyan);
  animation: obSegFill 0.5s cubic-bezier(0.22, 0.9, 0.28, 1) forwards;
  transform-origin: left;
}
@keyframes obSegFill {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
#ob-step-label {
  align-self: flex-start;
  font-size: 13px;
  color: var(--faint);
  margin-bottom: 26px;
  min-height: 18px;
}

#onboarding-card {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 40px 36px;
  text-align: center;
}
.ob-step-enter-fwd { animation: obInFwd 0.38s cubic-bezier(0.22, 0.9, 0.28, 1); }
.ob-step-enter-back { animation: obInBack 0.38s cubic-bezier(0.22, 0.9, 0.28, 1); }
@keyframes obInFwd {
  from { opacity: 0; transform: translateX(34px); }
  to { opacity: 1; transform: none; }
}
@keyframes obInBack {
  from { opacity: 0; transform: translateX(-34px); }
  to { opacity: 1; transform: none; }
}

/* Self-drawing 7 mark */
.ob-hero-mark {
  width: 112px;
  height: 112px;
  margin: 0 auto 26px;
  color: var(--cyan);
  filter: drop-shadow(0 0 18px rgba(34, 211, 238, 0.35));
}
.ob-hero-mark svg { width: 100%; height: 100%; }
.ob-draw {
  stroke-dasharray: 132;
  stroke-dashoffset: 132;
  animation: obDraw7 0.9s cubic-bezier(0.5, 0, 0.2, 1) 0.1s forwards;
}
@keyframes obDraw7 { to { stroke-dashoffset: 0; } }
.ob-pop {
  transform-box: fill-box;
  transform-origin: center;
  opacity: 0;
  animation: obPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  animation-delay: var(--pd, 0.5s);
}
@keyframes obPop {
  from { opacity: 0; transform: scale(0); }
  to { opacity: 1; transform: scale(1); }
}

.ob-name-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 8px;
}
.ob-name-input {
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 0 auto 26px;
  padding: 13px 18px;
  font-size: 16px;
  font-family: var(--font);
  color: var(--text);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  text-align: center;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.ob-name-input::placeholder { color: var(--faint); }
.ob-name-input:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px var(--cyan-glow);
}

.ob-title {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
}
.ob-title-sm { font-size: 24px; }
.ob-sub {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
  margin: 0 0 30px;
}

.ob-actions { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.ob-actions-row {
  flex-direction: row;
  justify-content: space-between;
  margin-top: 28px;
}
.ob-cta { width: 100%; max-width: 320px; font-size: 16px; padding: 14px 24px; }
.ob-actions-row .ob-cta { width: auto; max-width: none; margin: 0; }
.ob-skip {
  background: none;
  border: none;
  color: var(--faint);
  font-size: 14px;
  cursor: pointer;
  padding: 8px;
  margin-top: 6px;
}
.ob-skip:hover { color: var(--muted); }
.ob-link {
  background: none;
  border: none;
  color: var(--cyan);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
}

/* ---------- goals step ---------- */
.ob-goal-head {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  font-size: 13px;
  color: var(--faint);
  text-align: left;
  padding: 0 4px 8px;
}
.ob-goal-head span:first-child { font-weight: 600; }
.ob-goal-head .ob-link { justify-self: end; }
.ob-goal-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  max-height: 46vh;
  overflow-y: auto;
  padding: 2px;
  -webkit-overflow-scrolling: touch;
}
.ob-goal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--glass);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--glass-hi);
  animation: obRowIn 0.4s cubic-bezier(0.22, 0.9, 0.28, 1) backwards;
  animation-delay: var(--rd, 0ms);
}
@keyframes obRowIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.ob-goal-meta { min-width: 0; }
.ob-goal-name {
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ob-now { font-size: 13px; color: var(--muted); font-weight: 600; }

.ob-stepper {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 3px;
  flex-shrink: 0;
}
.ob-step-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--cyan);
  font-size: 19px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s;
}
.ob-step-btn:hover { background: var(--cyan-glow); }
.ob-step-btn:active { transform: scale(0.9); }
.ob-goal-input {
  width: 52px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 17px;
  font-weight: 800;
  text-align: center;
  font-family: var(--font);
  -moz-appearance: textfield;
  appearance: textfield;
}
.ob-goal-input::-webkit-outer-spin-button,
.ob-goal-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ob-goal-input:focus { outline: none; }
.ob-goal-input:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 6px; }

.ob-avg-line {
  margin: 18px 0 0;
  font-size: 14px;
  color: var(--muted);
}
.ob-avg-line strong { color: var(--cyan); font-size: 16px; display: inline-block; }
.ob-avg-line strong.ob-tick { animation: obTick 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes obTick {
  0% { transform: scale(1); }
  40% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

/* ---------- done step ---------- */
.ob-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 0 0 26px;
}
.ob-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 7px 12px 7px 14px;
}
.ob-chip strong {
  color: var(--cyan);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.ob-sub-tight { margin: -14px 0 26px; font-size: 14px; }

/* ---------- todos choice step ---------- */
.ob-choices { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.ob-choice {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  background: var(--card-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  color: var(--text);
  font-family: var(--font);
  text-align: left;
  transition: border-color 0.18s, transform 0.18s, background 0.18s;
}
.ob-choice:hover {
  border-color: var(--cyan);
  background: var(--card);
  transform: translateY(-1px);
}
.ob-choice:active { transform: translateY(0) scale(0.99); }
.ob-choice-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 12px;
  background: var(--cyan-glow);
  color: var(--cyan);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ob-choice-icon svg { width: 24px; height: 24px; }
.ob-choice-icon-muted { background: var(--line-soft); color: var(--faint); }
.ob-choice-text { display: flex; flex-direction: column; gap: 3px; }
.ob-choice-text strong { font-size: 16px; }
.ob-choice-text span span { font-size: 14px; color: var(--muted); }

/* ---------- done step ---------- */
.ob-done-mark {
  width: 88px;
  height: 88px;
  margin: 6px auto 24px;
  color: var(--good);
}
.ob-done-mark svg { width: 100%; height: 100%; }
.ob-done-mark circle {
  stroke-dasharray: 180;
  stroke-dashoffset: 180;
  animation: obDraw 0.7s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.ob-done-mark path {
  stroke-dasharray: 50;
  stroke-dashoffset: 50;
  animation: obDraw 0.45s cubic-bezier(0.4, 0, 0.2, 1) 0.55s forwards;
}
@keyframes obDraw { to { stroke-dashoffset: 0; } }

@media (max-width: 520px) {
  #onboarding-card { padding: 32px 22px; }
  .ob-title { font-size: 26px; }
  .ob-title-sm { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .ob-step-enter-fwd, .ob-step-enter-back, .ob-hero-mark,
  .ob-draw, .ob-pop, .ob-goal-row,
  .ob-done-mark circle, .ob-done-mark path, .ob-seg.is-now::after,
  .ob-avg-line strong.ob-tick { animation: none; }
  .ob-draw { stroke-dashoffset: 0; }
  .ob-pop { opacity: 1; }
  .ob-done-mark circle, .ob-done-mark path { stroke-dashoffset: 0; }
  .ob-goal-row { animation: none; }
  .ob-choice { transition: none; }
}
