/* agora — calm light UI, big type, one thing at a time.
   Palette per the ADHD literature (see CLAUDE.md): a cool, low-arousal
   blue ground (not pure black); warm SAND reserved for time itself (the
   hourglass); GREEN for action/go; RED appears only in overtime. */

:root {
  --bg: #fbfcfd;          /* white — light, airy, low-glare off-white */
  --panel: #ffffff;
  --panel-2: #edf1f5;
  --ink: #1b2a3a;         /* deep water blue as ink */
  --muted: #7b8a99;
  --line: #e2e8ee;
  --accent: #d9a94f;      /* sand — time (darkened for a white ground) */
  --action: #2fa568;      /* green — go / do / done */
  --good: #2fa568;
  --danger: #d84a38;      /* overtime only */
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, select {
  font: inherit; color: var(--ink);
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; font-size: 16px; /* ≥16px: no iOS zoom */
  width: 100%;
}
input::placeholder { color: #a6b1bc; }

.view {
  max-width: 560px; margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 18px calc(132px + env(safe-area-inset-bottom));
  min-height: 100dvh;
}
.view-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 18px; }
.view-head h1 { font-size: 26px; letter-spacing: -0.02em; }
.section-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); margin: 22px 0 10px;
}

/* ── buttons ─────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--action); color: #fff;
  font-weight: 700; font-size: 17px;
  padding: 14px 28px; border-radius: 14px;
  width: 100%;
}
.btn-primary:active { transform: scale(0.98); }
.btn-ghost {
  color: var(--muted); font-weight: 600; font-size: 15px;
  padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line);
}
.btn-done {
  background: var(--good); color: #fff;
  font-weight: 800; font-size: 17px;
  padding: 14px 26px; border-radius: 14px; flex: 1;
}
.btn-mini {
  background: var(--panel-2); border: 1px solid var(--line);
  font-weight: 700; font-size: 14px; padding: 10px 16px; border-radius: 10px;
  white-space: nowrap;
}

/* ── NOW ─────────────────────────────────────────────────────────── */
#now-empty, #now-finished { text-align: center; padding-top: 16vh; }
.empty-art { font-size: 54px; margin-bottom: 18px; }
.empty-title { font-size: 28px; margin-bottom: 10px; letter-spacing: -0.02em; }
.empty-sub { color: var(--muted); font-size: 16px; line-height: 1.5; max-width: 320px; margin: 0 auto 28px; }

.now-meta {
  display: flex; justify-content: space-between;
  font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 26px;
}
.now-task { text-align: center; margin-bottom: 10px; }
.now-project { font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 6px; }
#now-title { font-size: 30px; letter-spacing: -0.02em; line-height: 1.15; }

/* Time-Timer disc: the wedge IS the remaining time. Donut (thick ring with a
   calm center for the digits) so the spatial cue and the number never fight. */
.dial-wrap { position: relative; width: min(74vw, 320px); margin: 26px auto; }
.disc {
  width: 100%; aspect-ratio: 1; border-radius: 50%;
  background: conic-gradient(var(--accent) 0deg 360deg);
  position: relative;
}
.disc::after {
  content: ''; position: absolute; inset: 22%;
  background: var(--bg); border-radius: 50%;
}
.dial-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
#now-remaining { font-size: 52px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.dial-label { font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); margin-top: 2px; }
.dial-wrap.overtime #now-remaining { color: var(--danger); }
/* completion micro-reward: quick pulse on the whole dial */
@keyframes donepulse { 0% { transform: scale(1); } 35% { transform: scale(1.06); } 100% { transform: scale(1); } }
.dial-wrap.pulse { animation: donepulse 0.45s ease; }

.now-controls { display: flex; gap: 10px; align-items: stretch; margin-bottom: 26px; }
.up-next { text-align: center; color: var(--muted); font-size: 14px; }
.up-next b { color: var(--ink); font-weight: 600; }

/* ── PLAN ────────────────────────────────────────────────────────── */
.plan-summary { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.block-list { display: flex; flex-direction: column; gap: 8px; }
.block {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 12px 12px 14px;
}
.block.done { opacity: 0.45; }
.block.done .block-title { text-decoration: line-through; }
.block.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.block-title { flex: 1; font-size: 15px; font-weight: 600; line-height: 1.3; }
.block-proj { display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 2px; }
.block-min {
  font-size: 13px; font-weight: 700; color: var(--muted);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.block-btn {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--panel-2); border: 1px solid var(--line);
  font-size: 14px; color: var(--muted); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.block-btn:active { background: var(--line); }

.duration-picker { display: flex; gap: 8px; margin-bottom: 12px; }
.duration-picker button {
  flex: 1; padding: 10px 0; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--line);
  font-weight: 700; font-size: 14px; color: var(--muted);
}
.duration-picker button.on { background: var(--action); color: #fff; border-color: var(--action); }

.task-pick { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.task-pick .pick {
  display: flex; align-items: center; gap: 10px; text-align: left;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 14px; font-size: 15px; font-weight: 500;
}
.task-pick .pick .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.task-pick .pick .plus { margin-left: auto; color: var(--muted); font-weight: 700; }
.task-pick .none { color: var(--muted); font-size: 14px; padding: 6px 2px; }

.plan-actions { display: flex; gap: 10px; margin-top: 22px; }
.plan-actions .btn-primary { flex: 1; width: auto; }

.quick-row { display: flex; gap: 8px; margin-bottom: 16px; }
.quick-row select { width: auto; max-width: 130px; }
.muted-row { margin-top: 26px; opacity: 0.75; }

/* ── TIMELINE — the day as visual blocks ─────────────────────────── */
.timeline { display: flex; flex-direction: column; gap: 7px; margin-top: 18px; }
.tblock {
  display: flex; align-items: stretch; gap: 12px;
  background: var(--panel); border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 12px; padding: 10px 12px;
}
.tblock-time {
  font-size: 12px; font-weight: 700; color: var(--muted);
  font-variant-numeric: tabular-nums; white-space: nowrap;
  min-width: 92px; padding-top: 2px;
}
.tblock-body { flex: 1; display: flex; flex-direction: column; justify-content: flex-start; }
.tblock-proj { font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 1px; }
.tblock-title { font-size: 15px; font-weight: 600; line-height: 1.3; }
.tblock-state { font-size: 15px; color: var(--muted); font-weight: 700; padding-top: 2px; }
.tblock.done, .tblock.skipped { opacity: 0.42; }
.tblock.done .tblock-title { text-decoration: line-through; }
.tblock.current { border-color: var(--accent); box-shadow: 0 0 0 1.5px var(--accent); }
.tblock.overdue { border-color: var(--danger); box-shadow: 0 0 0 1.5px var(--danger); }
.tblock.overdue .tblock-state { color: var(--danger); }

/* ── DAY GRID — Structured-style 6am–11pm schedule ───────────────── */
.day-grid { margin-top: 20px; }
.dg-inner { position: relative; margin-left: 56px; border-left: 1px solid var(--line); }
.dg-line { position: absolute; left: 0; right: 0; height: 1px; background: var(--line); }
.dg-hour {
  position: absolute; left: -56px; width: 48px; text-align: right;
  font-size: 11px; font-weight: 600; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.dg-block {
  position: absolute; left: 8px; right: 2px;
  background: var(--panel); border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 10px; padding: 5px 10px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 1px 3px rgba(27,42,58,0.06);
}
.dg-time { font-size: 10.5px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.dg-title { font-size: 13.5px; font-weight: 600; line-height: 1.25; }
.dg-del {
  position: absolute; top: 4px; right: 6px;
  font-size: 13px; color: var(--muted); padding: 3px 5px;
}
.dg-grip {
  position: absolute; right: 6px; bottom: 4px;
  font-size: 15px; color: var(--muted); opacity: 0.7;
  padding: 4px 6px; cursor: grab;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.dg-block.lifting {
  z-index: 6; opacity: 0.94; cursor: grabbing;
  box-shadow: 0 8px 22px rgba(27,42,58,0.22);
}
.dg-block.done, .dg-block.skipped { opacity: 0.4; }
.dg-block.done .dg-title { text-decoration: line-through; }
.dg-block.current { border-color: var(--accent); box-shadow: 0 0 0 1.5px var(--accent); }
.dg-block.overdue { border-color: var(--danger); box-shadow: 0 0 0 1.5px var(--danger); }
.dg-nowline {
  position: absolute; left: -4px; right: 0; height: 2px;
  background: var(--danger); border-radius: 2px; pointer-events: none;
}
.dg-nowline::before {
  content: ''; position: absolute; left: -4px; top: -3px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--danger);
}
#add-block-form input[type="text"] { margin-bottom: 8px; }
#add-block-form select { margin-top: 8px; color: var(--muted); }

/* ── PLAN: date chips + time row ─────────────────────────────────── */
.date-chips { display: flex; gap: 8px; margin-bottom: 6px; }
.date-chips button {
  flex: 1; padding: 11px 0; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line);
  font-weight: 700; font-size: 14px; color: var(--muted);
}
.date-chips button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.when-row { display: flex; gap: 8px; margin-bottom: 12px; }
.when-row input[type="time"] { width: 118px; flex-shrink: 0; }
.when-row .duration-picker { flex: 1; margin-bottom: 0; }
.btn-tomorrow { display: block; margin: 12px auto 0; border: none; }

/* ── PROJECT CARDS + DETAIL ──────────────────────────────────────── */
.project-cards { display: flex; flex-direction: column; gap: 8px; }
.project-card {
  display: flex; align-items: center; gap: 12px; text-align: left;
  background: var(--panel); border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 12px; padding: 15px 14px;
}
.project-card:active { background: var(--panel-2); }
.pc-name { flex: 1; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.pc-count { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.pc-arrow { font-size: 20px; color: var(--muted); line-height: 1; }
.detail-head { display: flex; align-items: center; gap: 12px; }
.detail-head h1 { flex: 1; font-size: 22px; }
.detail-count { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.btn-back {
  width: 38px; height: 38px; border-radius: 11px;
  background: var(--panel); border: 1px solid var(--line);
  font-size: 22px; color: var(--muted); line-height: 1;
}

/* ── CALENDAR ────────────────────────────────────────────────────── */
.cal-nav { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.cal-month { flex: 1; text-align: center; font-size: 16px; font-weight: 700; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cg-dow {
  text-align: center; font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
  color: var(--muted); padding: 4px 0;
}
.cg-day {
  aspect-ratio: 1; border-radius: 10px; position: relative;
  background: var(--panel); border: 1px solid var(--line);
  font-size: 13.5px; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.cg-day.dim { opacity: 0.32; }
.cg-day.today { border-color: var(--accent); }
.cg-day.sel { background: var(--ink); color: #fff; border-color: var(--ink); }
.cg-dots { display: flex; gap: 2px; height: 5px; }
.cg-dots .dot { width: 5px; height: 5px; border-radius: 50%; }
.cg-dots .dot.g { background: #57a7ff; }
.cg-dots .dot.o { background: var(--accent); }
.cal-day { margin-top: 20px; }
.event-row.gcal { border-left: 3px solid #57a7ff; }
.gcal-help { font-size: 13px; color: var(--muted); line-height: 1.5; margin-bottom: 10px; }
.dg-block.gcal {
  background: rgba(87,167,255,0.10); border-color: rgba(87,167,255,0.35);
  border-left: 4px solid #57a7ff; pointer-events: none;
}

/* ── EVENTS / REMINDERS ──────────────────────────────────────────── */
.plan-events { margin-top: 34px; }
.push-enable {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; margin-bottom: 12px;
  display: flex; gap: 12px; align-items: center;
}
.push-enable p { flex: 1; font-size: 13px; color: var(--muted); line-height: 1.4; }
#event-form input[type="text"] { margin-bottom: 8px; }
.event-when-row { display: flex; gap: 8px; }
.event-when-row select { width: auto; }
.event-list { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.event-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px;
}
.event-row.past { opacity: 0.4; }
.event-title { flex: 1; font-size: 15px; font-weight: 600; }
.event-when { display: block; font-size: 12px; color: var(--muted); font-weight: 500; margin-top: 2px; }

/* ── TASKS ───────────────────────────────────────────────────────── */
.project-group { margin-bottom: 22px; }
.project-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  margin-bottom: 8px;
}
.project-head .dot { width: 9px; height: 9px; border-radius: 50%; }
.project-head .count { color: var(--muted); font-weight: 600; margin-left: auto; }
.task-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; margin-bottom: 6px;
}
.task-row.done { opacity: 0.4; }
.task-row.done .task-title { text-decoration: line-through; }
.task-check {
  width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid var(--muted); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: transparent;
}
.task-row.done .task-check { background: var(--good); border-color: var(--good); color: #0a1a10; }
.task-title { flex: 1; font-size: 15px; font-weight: 500; line-height: 1.3; }
.task-del { color: var(--muted); font-size: 16px; padding: 4px 6px; }

/* ── TAB BAR ─────────────────────────────────────────────────────── */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; justify-content: space-around;
  background: rgba(251,252,253,0.92); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
  z-index: 10;
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 11px; font-weight: 600; color: var(--muted);
  padding: 4px 22px; border-radius: 10px;
}
.tab .tab-ico { font-size: 19px; line-height: 1; }
.tab.on { color: var(--action); }
