* { box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
  --bg: #020617;
  --panel: #0f172a;
  --line: #1e293b;
  --line2: #334155;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #6366f1;
  --accent2: #818cf8;
  --ok: #10b981;
}

html, body { margin: 0; background: var(--bg); color: var(--text); font-family: Inter, system-ui, -apple-system, "Hind Siliguri", sans-serif; }
body { min-height: 100vh; }

.view { min-height: 100vh; }

/* Splash */
#splash { display: grid; place-items: center; overflow: hidden; position: relative; }
.splash-word { font-size: clamp(2.5rem, 10vw, 4rem); font-weight: 700; letter-spacing: .05em; display: flex; margin: 0; }
.splash-word span {
  display: inline-block;
  background: linear-gradient(to bottom, #fff, #a5b4fc);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: rise .5s both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(30px); filter: blur(8px); }
  to { opacity: 1; transform: none; filter: none; }
}
.splash-line {
  position: absolute; bottom: 64px; width: 160px; height: 4px; border-radius: 4px; background: var(--accent2);
  transform-origin: left; animation: grow 1.6s 1.2s both;
}
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) {
  .splash-word span, .splash-line { animation-duration: .01s; animation-delay: 0s !important; }
}

/* Layout */
.center-box { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 16px; padding: 24px; text-align: center; max-width: 380px; margin: 0 auto; }
.brand-big { font-size: 2rem; font-weight: 700; color: var(--text); text-decoration: none; cursor: pointer; }
.brand { font-size: 1.1rem; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.upper { text-transform: uppercase; letter-spacing: .15em; }
.center { text-align: center; align-items: center; }
.big { padding: 32px 16px; }

.topbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.content { max-width: 640px; margin: 0 auto; padding: 16px 16px 110px; display: flex; flex-direction: column; gap: 18px; }

.row { display: flex; align-items: center; }
.between { justify-content: space-between; }
.gap { gap: 14px; }
.grow { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid7 { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }

/* Cards and controls */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.item { padding: 12px 16px; }
.dim { opacity: .7; }
.badge { background: rgba(245, 158, 11, .2); color: #fcd34d; padding: 4px 12px; border-radius: 999px; font-size: .75rem; white-space: nowrap; }
.done { color: #64748b; text-decoration: line-through; }
.danger { color: #f87171; }

.btn-primary, .btn-ghost {
  width: 100%; padding: 12px 16px; border-radius: 12px; font-weight: 600; font-size: 1rem; cursor: pointer; text-align: center; text-decoration: none; transition: transform .1s;
}
.btn-primary { background: var(--accent); color: #fff; border: none; }
.btn-ghost { background: transparent; color: #e2e8f0; border: 1px solid var(--line2); }
.btn-primary:active, .btn-ghost:active { transform: scale(.97); }
.btn-primary:disabled { opacity: .5; }

.link { color: var(--accent2); font-size: .9rem; cursor: pointer; text-decoration: none; }
.link-btn { background: none; border: none; color: var(--muted); cursor: pointer; font-size: .9rem; padding: 4px 8px; }
.link-btn:hover { color: var(--text); }

.input {
  width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line2); background: #1e293b; color: var(--text); font-size: 1rem; outline: none;
}
.input:focus { border-color: var(--accent2); }
.input:disabled { opacity: .5; }

input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); flex-shrink: 0; }
label { cursor: pointer; }
.msg { min-height: 1.2em; margin: 0; font-size: .9rem; color: #f87171; }

.seg { display: grid; grid-template-columns: 1fr 1fr; width: 100%; background: var(--panel); border-radius: 12px; padding: 4px; }
.seg-btn { background: none; border: none; color: var(--muted); padding: 8px; border-radius: 9px; cursor: pointer; font-weight: 600; }
.seg-btn.on { background: var(--accent); color: #fff; }

/* Main tab chips and progress */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.chip { flex-shrink: 0; border: none; border-radius: 999px; padding: 8px 16px; background: #1e293b; color: #cbd5e1; cursor: pointer; font-size: .9rem; }
.chip.on { background: var(--accent); color: #fff; }
.bar { height: 8px; background: #1e293b; border-radius: 999px; overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s; }

/* Timer */
.ring { width: 224px; height: 224px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(#6366f1 0%, #1e293b 0); }
.ring-in { width: 192px; height: 192px; border-radius: 50%; background: var(--panel); display: grid; place-items: center; }
#t-time { font-size: 3rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Planner */
.day { position: relative; aspect-ratio: 1; border: none; border-radius: 10px; background: #1e293b; color: #cbd5e1; cursor: pointer; font-size: .9rem; }
.day.on { background: var(--accent); color: #fff; }
.day.today { box-shadow: inset 0 0 0 1px var(--accent2); }
.dot { position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); width: 5px; height: 5px; border-radius: 50%; background: var(--ok); }

/* Stats */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-label { font-size: .8rem; color: var(--muted); }
.stat-value { font-size: 1.35rem; font-weight: 700; margin-top: 4px; }
.stat-hint { font-size: .75rem; color: #64748b; margin-top: 4px; }
.trend { display: flex; align-items: flex-end; gap: 4px; height: 160px; }
.trend .col { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.trend .col i { display: block; width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }
.trend-axis { display: flex; justify-content: space-between; font-size: .7rem; color: #64748b; margin-top: 6px; }
.donut-row { display: grid; grid-template-columns: 110px 1fr; gap: 16px; align-items: center; }
.donut { width: 110px; height: 110px; border-radius: 50%; display: grid; place-items: center; }
.donut span { width: 74px; height: 74px; border-radius: 50%; background: var(--panel); display: grid; place-items: center; font-weight: 700; }
.hbar-row { display: grid; grid-template-columns: 130px 1fr 52px; gap: 8px; align-items: center; font-size: .8rem; margin-bottom: 6px; }
.hbar { height: 10px; background: #1e293b; border-radius: 999px; overflow: hidden; }
.hbar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.hbar-row span:last-child { text-align: right; color: var(--muted); }

/* Tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: rgba(15, 23, 42, .95); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); backdrop-filter: blur(8px); z-index: 10;
}
.tabbar button { flex: 1; background: none; border: none; color: var(--muted); padding: 14px 0; cursor: pointer; font-size: .95rem; }
.tabbar button.active { color: var(--accent2); font-weight: 600; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: #1e293b; color: var(--text);
  padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line2); font-size: .9rem; z-index: 20; max-width: 90vw;
}
