:root {
  --bg: #14112b; --card: #1f1a3d; --line: #2e2858; --text: #f3f0ff; --muted: #a49fc7;
  --accent: #ffb547; --good: #4fd1a5; --danger: #ff6b6b;
  --r: 18px;
  font-family: "Noto Sans Malayalam", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100dvh; }
main { max-width: 520px; margin: 0 auto; padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }
h1, h2 { margin: 0 0 10px; } h2 { font-size: 1.05rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .center { text-align: center; }
.big { font-size: 2rem; font-weight: 700; } .huge { font-size: 3.5rem; margin: 0; }
.empty { text-align: center; color: var(--muted); padding: 20px; }

.hero { text-align: center; padding: 8px 0 16px; }
.ring { --p: 0; width: 170px; height: 170px; margin: 12px auto; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--line) 0); transition: background .4s; }
.ring > div { width: 140px; height: 140px; border-radius: 50%; background: var(--bg); display: grid; place-content: center; }
.ring small { color: var(--muted); }
.chips { display: flex; gap: 8px; justify-content: center; }
.chip { display: inline-block; background: var(--card); border: 1px solid var(--line); padding: 6px 12px; border-radius: 99px; font-size: .9rem; }

.list { display: grid; gap: 10px; }
.habit { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; transition: .2s; }
.habit.done { border-color: var(--good); background: #1b2e3a; }
.tick { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--muted); background: none; color: #0b1a14; font-size: 1.3rem; font-weight: 800; cursor: pointer; }
.habit.done .tick { background: var(--good); border-color: var(--good); animation: pop .25s; }
@keyframes pop { 50% { transform: scale(1.18); } }
.hinfo { flex: 1; display: grid; gap: 2px; cursor: pointer; }
.hname { font-size: 1.02rem; }
.habit.done .hname { text-decoration: line-through; text-decoration-color: var(--good); }
.add { border: 2px dashed var(--line); background: none; color: var(--muted); border-radius: var(--r); padding: 14px; font: inherit; cursor: pointer; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 12px; }
.bars { display: flex; gap: 8px; align-items: flex-end; height: 120px; margin-top: 8px; }
.bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.bar i { width: 100%; background: var(--accent); border-radius: 6px 6px 2px 2px; min-height: 3px; }
.bar small { color: var(--muted); font-size: .7rem; }
.grid { display: grid; gap: 10px; }
.grow { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.gname { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dots { display: flex; gap: 4px; flex: none; }
.dots i { width: 14px; height: 14px; border-radius: 4px; background: var(--line); }
.dots i.on { background: var(--good); }

.btn { display: block; width: 100%; margin-top: 10px; padding: 14px; border: 0; border-radius: 14px; background: var(--accent); color: #1a1200; font: inherit; font-weight: 700; text-align: center; cursor: pointer; }
.btn.ghost { background: none; color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: none; color: var(--danger); border: 1px solid var(--danger); }
.btn[hidden] { display: none; }

input, select { width: 100%; margin-top: 6px; padding: 13px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; }
label { display: block; margin-top: 14px; text-align: left; }
.onboard { text-align: center; padding-top: 8vh; }
.onboard form { margin-top: 24px; }

#nav { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; background: rgba(20,17,43,.92); backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
#nav[hidden] { display: none; }
#nav button { flex: 1; max-width: 130px; background: none; border: 0; color: var(--muted); font: inherit; font-size: .75rem; padding: 10px 0; display: grid; gap: 2px; cursor: pointer; }
#nav button span { font-size: 1.3rem; }
#nav button.active { color: var(--accent); }

#sheet { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: flex-end; opacity: 0; pointer-events: none; transition: .2s; z-index: 10; }
#sheet.open { opacity: 1; pointer-events: auto; }
.sheet-body { width: 100%; max-width: 520px; margin: 0 auto; background: var(--card); border-radius: 22px 22px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); transform: translateY(100%); transition: .25s; }
#sheet.open .sheet-body { transform: none; }
.emojis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-top: 12px; }
.emojis label { margin: 0; }
.emojis input { display: none; }
.emojis span { display: grid; place-items: center; font-size: 1.5rem; padding: 8px; border-radius: 12px; border: 1px solid var(--line); cursor: pointer; }
.emojis input:checked + span { border-color: var(--accent); background: #3a2f1a; }

#toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%) translateY(20px); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 99px; opacity: 0; transition: .25s; pointer-events: none; z-index: 20; font-size: .9rem; }
#toast.show { opacity: 1; transform: translateX(-50%); }

.banner { background: #3a1f24; border: 1px solid var(--danger); color: #ffd6d6; border-radius: 14px; padding: 12px; margin-bottom: 12px; font-size: .9rem; }
.tick:disabled { opacity: .4; cursor: not-allowed; }
.seg { display: flex; gap: 6px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.seg button { flex: 1; border: 0; background: none; color: var(--muted); font: inherit; padding: 10px; border-radius: 9px; cursor: pointer; }
.seg button.on { background: var(--accent); color: #1a1200; font-weight: 700; }
.onboard .seg { max-width: 260px; margin: 0 auto 8px; }

/* v0.3: rank, shop, quiz, themes */
#nav button { max-width: 110px; font-size: .7rem; }
.quizbar { display: block; width: 100%; margin-bottom: 12px; padding: 14px; border: 0; border-radius: 14px; font: inherit; font-weight: 700; color: #1a1200; background: linear-gradient(90deg, var(--accent), #ff7ab6); cursor: pointer; animation: glow 2s infinite; }
@keyframes glow { 50% { filter: brightness(1.15); } }
.stats { display: flex; justify-content: space-around; text-align: center; }
.stats div { display: grid; gap: 2px; } .stats b { font-size: 1.4rem; } .stats small { color: var(--muted); }
.board { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.board li { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: var(--bg); }
.board li.me { outline: 2px solid var(--accent); }
.board .pos { width: 42px; text-align: center; font-weight: 700; }
.board .who { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.mini { flex: none; border: 0; border-radius: 10px; padding: 9px 12px; background: var(--accent); color: #1a1200; font: inherit; font-weight: 700; font-size: .85rem; cursor: pointer; }
.mini:disabled { opacity: .4; cursor: not-allowed; }
.sicon { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 1.3rem; background: var(--line); }
.sicon.theme_gold { background: #c9962b; } .sicon.theme_ocean { background: #1f8fb8; } .sicon.theme_rose { background: #d6578a; }
.qtext { font-size: 1.1rem; margin: 14px 0 6px; }
.opt { text-align: left; }

body[data-theme="theme_gold"]  { --bg: #17140c; --card: #241f12; --line: #3d3420; --accent: #f5c542; --good: #e6b422; }
body[data-theme="theme_ocean"] { --bg: #08171f; --card: #0f2530; --line: #1c3b4a; --accent: #4fc3f7; --good: #26c6da; }
body[data-theme="theme_rose"]  { --bg: #1c0e15; --card: #2a1520; --line: #452436; --accent: #ff8fb8; --good: #f06292; }
.btn.google { display: flex; align-items: center; justify-content: center; gap: 10px; background: #fff; color: #222; margin-top: 24px; }
.or { margin: 18px 0 0; text-align: center; }
.btn.wa { background: #25d366; color: #062b14; text-decoration: none; margin: 0 0 12px; }
.banner.info { background: #1d2a44; border-color: #4f7fd1; color: #dfe9ff; }
