/* Kundli Krab: modern, simple. One column, one action at a time. */

:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --surface-2: #f3eee7;
  --text: #1f1a17;
  --muted: #776d65;
  --line: #e8e1d8;
  --brand: #9f1239; /* sindoor maroon */
  --brand-ink: #ffffff;
  --brand-soft: #fde8ec;
  --accent: #d97706; /* marigold */
  --accent-soft: #fef3c7;
  --good: #15803d;
  --good-soft: #dcfce7;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --bad: #b91c1c;
  --bad-soft: #fee2e2;
  --shadow: 0 1px 2px rgba(31, 26, 23, 0.06), 0 8px 24px rgba(31, 26, 23, 0.06);
  --radius: 20px;
  --radius-sm: 12px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16120f;
    --surface: #211b17;
    --surface-2: #2a231e;
    --text: #f5efe8;
    --muted: #a89b90;
    --line: #3a302a;
    --brand: #f43f5e;
    --brand-ink: #1a0b10;
    --brand-soft: #3b1520;
    --accent: #fbbf24;
    --accent-soft: #3a2a0c;
    --good: #4ade80;
    --good-soft: #10291a;
    --warn: #fbbf24;
    --warn-soft: #33270d;
    --bad: #f87171;
    --bad-soft: #3a1414;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.app { max-width: 480px; margin: 0 auto; padding: 0 16px 48px; }

/* ---------- Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
}
.logo { font-weight: 700; letter-spacing: -0.02em; font-size: 18px; display: flex; gap: 6px; align-items: center; }
.logo small { font-weight: 500; color: var(--muted); font-size: 12px; }
.tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 999px; }
.tab {
  border: 0; background: transparent; padding: 6px 12px; border-radius: 999px;
  font-size: 14px; font-weight: 500; color: var(--muted);
}
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.count { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 999px; background: var(--brand); color: var(--brand-ink); font-size: 11px; line-height: 18px; text-align: center; }

/* ---------- Type */
h1 { font-size: 32px; line-height: 1.15; letter-spacing: -0.03em; margin: 8px 0 12px; }
h2 { font-size: 22px; line-height: 1.25; letter-spacing: -0.02em; margin: 0 0 6px; }
h3 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 10px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- Surfaces */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.stack > * + * { margin-top: 16px; }
.section { margin-top: 20px; }

/* ---------- Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  padding: 12px 18px; border-radius: 999px; font-weight: 600;
  transition: transform 0.08s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.row { display: flex; gap: 10px; align-items: center; }
.row.spread { justify-content: space-between; }

/* ---------- Landing */
.hero { padding: 32px 0 8px; }
.hero .avatars { display: flex; margin-bottom: 20px; }
.hero .avatars .av { width: 56px; height: 56px; margin-right: -12px; border-radius: 50%; box-shadow: 0 0 0 3px var(--bg); }
.steps { list-style: none; padding: 0; margin: 20px 0 28px; display: grid; gap: 10px; }
.steps li { display: flex; gap: 12px; align-items: flex-start; }
.steps .n { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 13px; display: grid; place-items: center; }

/* ---------- Forms */
.progress { height: 4px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 6px 0 20px; }
.progress > div { height: 100%; background: var(--brand); border-radius: 999px; transition: width 0.25s ease; }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
input[type="text"], input[type="date"], input[type="time"], select {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface);
}
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--surface); padding: 8px 14px;
  border-radius: 999px; font-size: 14px; font-weight: 500;
}
.chip.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.option {
  display: block; width: 100%; text-align: left; margin-bottom: 10px;
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm);
  padding: 14px 16px; font-weight: 500;
}
.option:hover { border-color: var(--brand); }
.kundli-preview { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 14px; }
.check { display: flex; gap: 10px; align-items: center; font-size: 14px; margin: 4px 0 16px; }

/* ---------- Swipe card */
.profile { padding: 0; overflow: hidden; }
.profile .head { padding: 28px 20px 16px; text-align: center; background: linear-gradient(180deg, var(--surface-2), var(--surface)); }
.profile .head .av { width: 132px; height: 132px; margin: 0 auto 14px; }
.profile .body { padding: 4px 20px 20px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 14px; justify-content: center; }
.tag { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.tag.good { background: var(--good-soft); color: var(--good); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.brand { background: var(--brand-soft); color: var(--brand); }
.reasons { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: 14px; }
.reasons li { display: flex; gap: 8px; }
.reasons li::before { content: "✦"; color: var(--accent); }
.actions { display: flex; justify-content: center; gap: 20px; margin: 20px 0 6px; }
.round {
  width: 64px; height: 64px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); box-shadow: var(--shadow); font-size: 26px; display: grid; place-items: center;
  transition: transform 0.08s ease;
}
.round:active { transform: scale(0.92); }
.round.like { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.hint { text-align: center; font-size: 12px; color: var(--muted); }

/* ---------- Bars */
.bars { display: grid; gap: 10px; }
.bar .label { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.bar .track { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar .fill { height: 100%; border-radius: 999px; background: var(--brand); }
.bar .fill.alt { background: var(--accent); }
.bar.stated .label b::after { content: " · you said"; font-weight: 500; color: var(--muted); }

/* ---------- Lists */
.list { display: grid; gap: 10px; }
.item {
  display: flex; gap: 14px; align-items: center; width: 100%; text-align: left;
  background: var(--surface); border: 0; border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px;
}
.item .av { width: 52px; height: 52px; flex: none; }
.item .grow { flex: 1; min-width: 0; }
.item .score { font-weight: 700; color: var(--brand); }

/* ---------- Modal / sheet */
.sheet-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 480px; max-height: 92dvh; overflow-y: auto;
  background: var(--bg); border-radius: 24px 24px 0 0; padding: 20px 16px 32px;
  animation: up 0.22s ease;
}
@keyframes up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.koota { display: grid; grid-template-columns: 110px 1fr 44px; gap: 10px; align-items: center; font-size: 14px; }
.koota .track { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.koota .fill { height: 100%; background: var(--accent); border-radius: 999px; }
.koota .pts { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60;
  width: calc(100% - 32px); max-width: 448px;
  background: var(--text); color: var(--bg); border-radius: var(--radius); padding: 14px 16px;
  display: flex; gap: 12px; align-items: center; box-shadow: var(--shadow); animation: up 0.22s ease;
}
.toast .av { width: 44px; height: 44px; flex: none; }
.toast .btn { padding: 8px 14px; }

.reveal { border-left: 3px solid var(--accent); background: var(--accent-soft); padding: 12px 14px; border-radius: var(--radius-sm); font-size: 15px; }
.empty { text-align: center; padding: 48px 16px; }
.empty .big { font-size: 44px; margin-bottom: 8px; }
.footer { margin-top: 32px; text-align: center; font-size: 12px; color: var(--muted); }
.footer a { color: inherit; }
.av svg { width: 100%; height: 100%; display: block; }

/* ---------- Manual chart editor */
.editor { margin-top: 12px; padding: 14px; border: 1px dashed var(--line); border-radius: var(--radius-sm); }
.editor .field:last-child { margin-bottom: 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn.small { padding: 8px 4px; font-size: 13px; font-weight: 500; }

/* ---------- Insights */
.insight { background: var(--brand-soft); border-radius: var(--radius-sm); padding: 10px 12px; margin: 4px 0 14px; font-weight: 600; font-size: 14px; }
.insight::before { content: "🔍 "; }
.headline { font-size: 18px; font-weight: 650; letter-spacing: -0.01em; line-height: 1.35; margin: 0 0 10px; }
.reasons.evidence li::before { content: "→"; color: var(--muted); }
.note { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 14px; margin-bottom: 8px; }

/* ---------- Narrow screens */
.logo { white-space: nowrap; }
@media (max-width: 400px) {
  .logo { font-size: 16px; }
  .tab { padding: 6px 9px; font-size: 13px; }
}

/* ---------- Chat */
.chat { display: grid; gap: 10px; margin-bottom: 12px; }
.msg { display: flex; flex-direction: column; align-items: flex-start; }
.msg.mine { align-items: flex-end; }
.bubble { max-width: 85%; padding: 9px 13px; border-radius: 16px 16px 16px 4px; background: var(--surface-2); font-size: 15px; }
.msg.mine .bubble { background: var(--brand); color: var(--brand-ink); border-radius: 16px 16px 4px 16px; }
.picked { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.pick { font-size: 11px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 2px 8px; }
.pick::before { content: "picked up: "; font-weight: 500; opacity: 0.8; }
.starters { margin-bottom: 10px; }
.starters .chip { font-size: 13px; padding: 6px 11px; }
.compose input { flex: 1; }
textarea { width: 100%; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); font: inherit; color: inherit; resize: vertical; }

.pick.ai { color: var(--good); background: var(--good-soft); }
.pick.ai::before { content: "AI: "; }
.ai-toggle { align-items: flex-start; font-size: 13px; color: var(--muted); }
.ai-toggle b { color: var(--text); }
.ai-toggle input { margin-top: 3px; }

/* ---------- Boot screen (until the app mounts) */
.boot { min-height: 70dvh; display: grid; place-items: center; align-content: center; gap: 10px; color: var(--muted); font-size: 14px; }
.boot-crab { font-size: 40px; animation: bob 1.2s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px); } }
body:has(.app) .boot { display: none; }
@media (prefers-reduced-motion: reduce) { .boot-crab { animation: none; } }
