:root {
  --bg: #050507;
  --card: #161622;
  --card-2: #0c0c14;
  --ink: #f8f8fc;
  --muted: #a3a3b8;
  --faint: #6b6b80;
  --line: #262636;
  --accent: #2563eb;
  --accent-2: #3b82f6;
  --accent-ink: #ffffff;
  --accent-soft: #1b2440;
  --pink: #e94665;
  --violet: #9264ac;
  --grad: linear-gradient(90deg, var(--pink), var(--violet), var(--accent-2));
  --warn: #e94665;
  --warn-soft: #1d1420;
  --danger: #e94665;
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, .8);
  --serif: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --sans: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --nav-h: 64px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 500 16px/1.5 var(--sans); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; border-radius: 3px; }

.app { max-width: 560px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; padding: 0 16px calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px); }

/* boot */
.boot { flex: 1; display: grid; place-items: center; min-height: 80dvh; }
.boot-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--grad); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.6); opacity: .5; } }

/* top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: calc(env(safe-area-inset-top) + 14px) 0 10px; }
.wordmark { font-size: 18px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.sync { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 10px var(--accent-2); }
.sync.off { background: var(--pink); box-shadow: 0 0 10px var(--pink); }
.icon-btn { width: 40px; height: 40px; border-radius: 4px; display: grid; place-items: center; color: var(--muted); }
.icon-btn:hover { background: var(--card); color: var(--ink); }
.icon-btn svg { width: 22px; height: 22px; }

/* banners */
.banner { background: var(--card); border-left: 4px solid var(--pink); border-radius: 4px; padding: 14px 16px; margin: 4px 0 10px; }
.banner-title { font-weight: 600; display: flex; gap: 8px; align-items: baseline; }
.banner-title small { font-weight: 400; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { border: 1px solid var(--line); background: var(--card-2); border-radius: 4px; padding: 7px 12px; font-size: 13px; font-weight: 700; color: var(--muted); }
.chip:hover { color: var(--ink); }
.chip:hover { border-color: var(--accent-2); }
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip.ghost { background: transparent; }
.chip.solid { background: var(--accent); color: #fff; border-color: var(--accent); }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-2); background: var(--card); border-radius: 4px; padding: 6px 10px; }
.pill.due-soon { color: var(--pink); }

/* NOW */
.now { display: flex; flex-direction: column; flex: 1; padding-top: 6px; }
.eyebrow { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); letter-spacing: .02em; }
.eyebrow .proj { font-weight: 700; text-transform: uppercase; letter-spacing: .22em; font-size: 12px; color: var(--accent-2); }
.eyebrow { font-variant-numeric: tabular-nums; }
.now .eyebrow::before { content: ""; position: absolute; width: 72px; height: 4px; border-radius: 2px; background: var(--grad); margin-top: -18px; }
.now .eyebrow { position: relative; margin-top: 22px; }
.task-title { font-weight: 800; text-transform: uppercase; font-size: clamp(30px, 8.5vw, 46px); line-height: 1.04; letter-spacing: -.01em; text-wrap: balance; margin: 14px 0 8px; overflow-wrap: anywhere; }
.notes { color: var(--muted); margin: 0 0 8px; white-space: pre-wrap; }
.meta-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }

.timer { margin: 18px 0 14px; background: var(--card); border-radius: 4px; padding: 18px; display: grid; grid-template-columns: 112px 1fr; gap: 18px; align-items: center; box-shadow: var(--shadow); }
.ring { position: relative; width: 112px; height: 112px; }
.ring svg { width: 112px; height: 112px; transform: rotate(-90deg); }
.ring .track { stroke: var(--line); }
.ring .prog { stroke: url(#ringGrad); transition: stroke-dashoffset .4s linear; }
.ring .digits { position: absolute; inset: 0; display: grid; place-items: center; font-size: 26px; font-variant-numeric: tabular-nums; font-weight: 800; letter-spacing: -.02em; }
.timer.running .digits { color: var(--ink); }
.timer-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.timer-len { align-self: flex-start; font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-2); border-bottom: 1px dashed color-mix(in srgb, var(--accent-2) 40%, transparent); padding-bottom: 1px; text-align: left; }
.timer-len:hover { color: var(--ink); border-color: var(--accent-2); }
.timer-ctl { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { border-radius: 4px; padding: 10px 16px; font-weight: 700; font-size: 14px; background: var(--accent-soft); color: var(--ink); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-2); }
.btn.quiet { background: transparent; border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }

.btn-done { margin-top: auto; width: 100%; background: var(--grad); color: #fff; border-radius: 4px; font-size: 18px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; padding: 20px; box-shadow: 0 14px 34px -14px color-mix(in srgb, var(--violet) 80%, transparent); transition: transform .08s, filter .15s; }
.btn-done:hover { filter: brightness(1.08); }
.btn-done:active { transform: scale(.985); }
.quiet-row { display: flex; justify-content: space-between; gap: 8px; margin: 14px 2px 0; }
.quiet-row button { font-size: 14px; color: var(--muted); padding: 6px 2px; }
.quiet-row button:hover { color: var(--ink); }
.next-up { font-size: 13px; color: var(--faint); margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.other-timer { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; background: var(--card); border-left: 4px solid var(--accent); border-radius: 4px; padding: 10px 12px; margin-bottom: 10px; }

.empty { text-align: center; margin: auto 0; padding: 40px 10px; }
.empty h1 { font-weight: 800; text-transform: uppercase; font-size: 40px; margin: 0 0 6px; }
.empty p { color: var(--muted); margin: 0 0 18px; }

/* views */
.view-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 6px 0 4px; flex-wrap: wrap; }
.view-head h2 { font-weight: 800; text-transform: uppercase; font-size: 24px; letter-spacing: .01em; margin: 0; }
.view-head h2::before { content: ""; display: block; width: 52px; height: 3px; border-radius: 2px; background: var(--grad); margin-bottom: 9px; }
.view-head .actions { display: flex; gap: 6px; }
.sub { color: var(--muted); margin: 0 0 14px; font-size: 15px; }
.section { margin: 22px 0 0; }
.section-h { font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-2); margin: 0 0 8px; display: flex; justify-content: space-between; }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.row { background: var(--card); border-radius: 4px; border-left: 4px solid transparent; }
.row.is-now { border-left-color: var(--accent); }
.row-main { display: flex; width: 100%; text-align: left; gap: 10px; padding: 12px 14px; align-items: flex-start; }
.row-num { color: var(--muted); font-size: 13px; min-width: 18px; padding-top: 2px; font-variant-numeric: tabular-nums; }
.row-body { flex: 1; min-width: 0; }
.row-title { display: block; overflow-wrap: anywhere; font-weight: 700; }
.row-meta { display: block; font-size: 12px; color: var(--faint); margin-top: 2px; }
.tag-now { font-size: 10px; font-weight: 800; letter-spacing: .14em; color: var(--pink); }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 12px 42px; }
.row-actions .chip { font-size: 13px; padding: 5px 10px; }
.chip.warn { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
details.section > summary { cursor: pointer; list-style: none; }
details.section > summary::-webkit-details-marker { display: none; }

/* thoughts */
.thought-box { background: var(--card); border-left: 4px solid var(--violet); border-radius: 4px; padding: 14px; }
.thought-box textarea { width: 100%; border: 0; background: transparent; resize: vertical; min-height: 88px; outline: none; font-size: 17px; }
.thought-box .bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.thought-box .hint { font-size: 12px; color: var(--muted); }
.thought { background: var(--card); border-radius: 4px; padding: 12px 14px; }
.thought p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.thought .meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.thought .meta .acts { display: flex; gap: 12px; }
.thought .meta button { color: var(--muted); font-size: 13px; }
.thought .meta button:hover { color: var(--ink); }

/* nav */
.nav { position: fixed; left: 0; right: 0; bottom: 0; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
.nav-in { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); height: var(--nav-h); }
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 12px; color: var(--muted); text-decoration: none; font-weight: 500; position: relative; }
.nav a svg { width: 22px; height: 22px; }
.nav a.on { color: var(--ink); }
.nav a.on::after { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 2px 2px; background: var(--grad); }
.nav a span:not(.count) { font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.nav .count { position: absolute; top: 8px; left: calc(50% + 8px); background: var(--pink); color: #fff; font-size: 10px; border-radius: 999px; padding: 0 5px; line-height: 16px; }

/* sheets */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); backdrop-filter: blur(3px); z-index: 30; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s ease-out; }
@keyframes fade { from { opacity: 0; } }
.sheet { background: var(--card-2); border-top: 1px solid var(--line); width: 100%; max-width: 560px; max-height: 92dvh; overflow: auto; border-radius: 8px 8px 0 0; padding: 10px 18px calc(22px + env(safe-area-inset-bottom)); animation: up .2s cubic-bezier(.2, .8, .2, 1); }
@keyframes up { from { transform: translateY(24px); opacity: .6; } }
@media (min-width: 640px) { .scrim { align-items: center; } .sheet { border-radius: 6px; border: 1px solid var(--line); } }
.grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 0 auto 10px; }
.sheet h3 { font-weight: 800; text-transform: uppercase; font-size: 20px; margin: 4px 0 6px; }
.sheet h3::before { content: ""; display: block; width: 52px; height: 3px; border-radius: 2px; background: var(--grad); margin-bottom: 10px; }
.sheet .lead { color: var(--muted); margin: 0 0 14px; font-size: 15px; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; }
.field > span { font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-2); }
.field small { color: var(--muted); font-size: 12px; }
.input, .sheet textarea, .sheet select { width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 4px; padding: 11px 12px; outline: none; }
.input:focus, .sheet textarea:focus, .sheet select:focus { border-color: var(--accent-2); }
.sheet textarea { resize: vertical; min-height: 120px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sheet-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; flex-wrap: wrap; }
.divider { height: 1px; background: var(--line); margin: 18px 0; }
.set-h { font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--pink); margin: 0 0 10px; }
.switch { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.switch input { width: 44px; height: 26px; appearance: none; background: var(--line); border-radius: 999px; position: relative; cursor: pointer; transition: background .15s; flex-shrink: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(18px); }
.device { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.device small { display: block; color: var(--muted); }
.copyrow { display: flex; gap: 6px; }
.copyrow .input { flex: 1; min-width: 0; }

/* time's up */
.timesup { text-align: center; padding: 10px 4px 4px; }
.timesup .big { font-size: 34px; font-weight: 800; text-transform: uppercase; line-height: 1.05; margin: 6px 0 2px; }
.timesup .chips { justify-content: center; }

/* auth */
.auth { flex: 1; display: flex; flex-direction: column; justify-content: center; min-height: 90dvh; max-width: 380px; margin: 0 auto; width: 100%; }
.auth .logo { width: 56px; height: 56px; border-radius: 8px; margin-bottom: 18px; }
.auth h1::before { content: ""; display: block; width: 72px; height: 4px; border-radius: 2px; background: var(--grad); margin-bottom: 18px; }
.auth h1 { font-weight: 800; text-transform: uppercase; font-size: 38px; line-height: 1.02; margin: 0 0 10px; }
.auth p { color: var(--muted); margin: 0 0 22px; }
.err { color: var(--danger); font-size: 14px; min-height: 20px; margin: -4px 0 10px; }

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 14px); transform: translate(-50%, 20px); background: var(--card); color: var(--ink); border-left: 4px solid var(--accent-2); box-shadow: var(--shadow); padding: 12px 16px; border-radius: 4px; font-size: 14px; opacity: 0; pointer-events: none; transition: all .2s; z-index: 50; max-width: calc(100% - 32px); display: flex; gap: 12px; align-items: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { color: var(--accent-2); font-weight: 700; }

@media (min-width: 900px) {
  .app { padding-top: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* 360 dark line: background glow + square bullets */
body::before { content: ""; position: fixed; right: -220px; top: -220px; width: 620px; height: 620px; border-radius: 50%; background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 24%, transparent), transparent 70%); pointer-events: none; z-index: -1; }
body::after { content: ""; position: fixed; left: -200px; bottom: -160px; width: 480px; height: 480px; border-radius: 50%; background: radial-gradient(closest-side, color-mix(in srgb, var(--pink) 12%, transparent), transparent 70%); pointer-events: none; z-index: -1; }
.notes { color: var(--muted); }
.quiet-row button { font-weight: 600; }
.timesup .pill { color: var(--pink); }
.thought p::before { content: ""; display: inline-block; width: 6px; height: 6px; background: var(--violet); margin: 0 9px 2px 0; }
.timesup .btn.primary { background: var(--grad); text-transform: uppercase; letter-spacing: .16em; font-weight: 800; }
.timer-ctl .btn { padding: 9px 13px; }

/* compact layout when the window is small (desktop app window resized) */
@media (max-height: 700px) and (min-width: 300px) {
  .topbar { padding-top: 8px; padding-bottom: 4px; }
  .now .eyebrow { margin-top: 14px; }
  .task-title { font-size: clamp(22px, 6vw, 32px); margin: 8px 0 6px; }
  .timer { margin: 10px 0; padding: 12px; grid-template-columns: 80px 1fr; gap: 12px; }
  .ring, .ring svg { width: 80px; height: 80px; }
  .ring .digits { font-size: 19px; }
  .btn-done { padding: 14px; font-size: 15px; }
  .quiet-row { margin-top: 8px; }
  .quiet-row button { font-size: 13px; }
  .next-up { margin-top: 10px; padding-top: 8px; }
  :root { --nav-h: 54px; }
  .nav a svg { width: 18px; height: 18px; }
}
