@font-face {
  font-family: 'Geist Variable';
  src: url('/fonts/geist-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Newsreader Variable';
  src: url('/fonts/newsreader-latin-opsz-normal.woff2') format('woff2');
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --ground: #060912;
  --text: #f2f6ff;
  --text-2: #b9c4dd;
  --text-3: #8390ad;
  --glass: rgba(255, 255, 255, 0.07);
  --glass-hover: rgba(255, 255, 255, 0.11);
  --scrim: rgba(6, 9, 18, 0.72);
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.2);
  --ok: #2cf5a6;
  --bad: #ff5470;
  --ui: 'Geist Variable', system-ui, sans-serif;
  --voice: 'Newsreader Variable', Georgia, serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --pad: 20px;
  /* aurora colours; swapped by body[data-light] */
  --a: #3a4663;
  --b: #2b3350;
  --c: #232a45;
  --glow: 0.5;
}
body[data-light='calm'] { --a: #19e3b1; --b: #7a5cff; --c: #1e6bff; --glow: 0.42; }
body[data-light='note'] { --a: #ff9a2e; --b: #ff3d6e; --c: #7a5cff; --glow: 0.55; }

.t-blue { --tag: #6fb1ff; }
.t-coral { --tag: #ff8f70; }
.t-teal { --tag: #19e3b1; }
.t-violet { --tag: #a895ff; }
.t-amber { --tag: #ffc857; }
.t-pink { --tag: #ff7ab8; }

* { box-sizing: border-box; }
html { background: var(--ground); color-scheme: dark; scrollbar-color: rgba(255, 255, 255, 0.18) transparent; scrollbar-width: thin; }
body {
  margin: 0;
  font: 400 15px/1.45 var(--ui);
  color: var(--text);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
  min-height: 100dvh;
  caret-color: var(--a);
}
::selection { background: color-mix(in srgb, var(--b) 55%, transparent); color: var(--text); }
button, input, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; border-radius: 6px; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- the light: three soft sources that report what the pendant is doing */
.aurora { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.aurora i {
  position: absolute; width: 70vmax; height: 70vmax; border-radius: 50%;
  filter: blur(90px); opacity: var(--glow);
  transition: background-color 1.4s var(--ease), opacity 1.4s var(--ease);
  animation: drift 38s ease-in-out infinite alternate;
}
.aurora i:nth-child(1) { background: var(--a); top: -46vmax; left: -30vmax; }
.aurora i:nth-child(2) { background: var(--b); top: -38vmax; right: -40vmax; animation-duration: 47s; animation-direction: alternate-reverse; }
.aurora i:nth-child(3) { background: var(--c); bottom: -58vmax; left: 10vmax; opacity: calc(var(--glow) * 0.6); animation-duration: 55s; }
body[data-light='note'] .aurora i { animation-duration: 9s; }
@keyframes drift { to { transform: translate3d(6vmax, 5vmax, 0) scale(1.12); } }

#app { position: relative; z-index: 1; max-width: 660px; margin: 0 auto; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }

/* ---------- top */
.top { padding: calc(22px + env(safe-area-inset-top)) var(--pad) 6px; display: flex; align-items: flex-start; gap: 12px; }
.top h1 { font: 650 1.375rem/1.15 var(--ui); letter-spacing: -0.01em; margin: 0; }
.status { margin: 6px 0 0; color: var(--text-2); font-size: 0.8125rem; display: flex; align-items: center; gap: 8px; }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.status[data-s='calm'] .dot { background: var(--ok); }
.status[data-s='note'] .dot { background: #ff9a2e; animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.7); opacity: 0.45; } }
.top .grow { flex: 1; min-width: 0; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--text-2); transition: background-color 0.2s, color 0.2s; }
.icon-btn:hover { background: var(--glass); color: var(--text); }

.search { margin: 8px var(--pad) 0; position: relative; }
.search input { width: 100%; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--glass); padding: 0 14px; font-size: 1rem; }
.search input::placeholder, .composer textarea::placeholder { color: var(--text-3); }
.search input:focus, .composer textarea:focus, .edit textarea:focus, .tag-edit input:focus { outline: none; border-color: var(--line-strong); }

/* ---------- filters */
.filters { display: flex; gap: 8px; overflow-x: auto; padding: 14px var(--pad) 12px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 34px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--line);
  color: var(--text-2); font-size: 0.8125rem; font-weight: 500; display: inline-flex; align-items: center; gap: 7px;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s; white-space: nowrap;
}
.chip:hover { background: var(--glass); color: var(--text); }
.chip b { font-weight: 500; color: var(--text-3); }
.chip .sw { width: 8px; height: 8px; border-radius: 50%; background: var(--tag); }
.chip[aria-pressed='true'] { background: var(--text); border-color: var(--text); color: var(--ground); }
.chip[aria-pressed='true'] b { color: rgba(6, 9, 18, 0.62); }
.chip.quiet { border-style: dashed; }

/* ---------- stream */
.day {
  position: sticky; top: 0; z-index: 3; margin: 0; padding: 10px var(--pad) 8px;
  font: 500 0.8125rem/1.2 var(--ui); color: var(--text-2);
  background: rgba(6, 9, 18, 0.42); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}
.day span { color: var(--text-3); margin-left: 8px; font-weight: 400; }
.group { margin-bottom: 18px; }
.idea { display: grid; grid-template-columns: 46px minmax(0, 1fr) 44px; gap: 0 6px; padding: 16px 10px 14px var(--pad); border-bottom: 1px solid var(--line); animation: land 0.6s var(--ease) backwards; }
.group .idea:last-child { border-bottom: 0; }
@keyframes land { from { opacity: 0; transform: translateY(10px); filter: blur(6px); } }
.idea time { color: var(--text-3); font-size: 0.75rem; padding-top: 5px; }
.idea .body { min-width: 0; }
.idea .words {
  display: block; width: 100%; text-align: left; font: 400 1.125rem/1.42 var(--voice); font-optical-sizing: auto;
  color: var(--text); text-wrap: pretty; overflow-wrap: anywhere; cursor: pointer; white-space: pre-wrap;
}
.idea[data-status='done'] .words { color: var(--text-3); text-decoration: line-through; text-decoration-color: rgba(131, 144, 173, 0.6); }
.idea .meta { margin-top: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 30px; }
.note-line { color: var(--text-3); font-size: 0.75rem; display: inline-flex; align-items: center; gap: 6px; }
.note-line.warn { color: #ffc857; }
.link { color: var(--text-2); font-size: 0.8125rem; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); padding: 6px 2px; }
.link:hover { color: var(--text); }

/* a guess is outlined and asks; a decision is filled and states */
.tag {
  height: 30px; padding: 0 11px; border-radius: 999px; font-size: 0.8125rem; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px; color: var(--tag); border: 1px solid transparent;
  background: color-mix(in srgb, var(--tag) 16%, transparent); transition: background-color 0.2s, border-color 0.2s;
}
.tag:hover { background: color-mix(in srgb, var(--tag) 26%, transparent); }
.tag.guess { background: transparent; border: 1px dashed color-mix(in srgb, var(--tag) 70%, transparent); }
.tag.guess:hover { background: color-mix(in srgb, var(--tag) 14%, transparent); }
.tag.none { --tag: var(--text-2); background: transparent; border: 1px dashed var(--line-strong); }
.tag svg { width: 14px; height: 14px; }

.done-btn { width: 44px; height: 44px; margin-top: -8px; display: grid; place-items: center; color: var(--text-3); border-radius: 50%; }
.done-btn span { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid currentColor; display: grid; place-items: center; transition: background-color 0.25s var(--ease), border-color 0.25s, color 0.25s; }
.done-btn svg { width: 14px; height: 14px; stroke-width: 2.4; opacity: 0; transition: opacity 0.2s; }
.done-btn:hover { color: var(--text); }
.idea[data-status='done'] .done-btn span { background: var(--ok); border-color: var(--ok); color: var(--ground); }
.idea[data-status='done'] .done-btn svg { opacity: 1; }

/* in-place drawers: tag picker and detail */
.drawer { grid-column: 2 / -1; margin: 12px 10px 2px 0; padding: 12px; border-radius: 16px; background: var(--glass); border: 1px solid var(--line); animation: open 0.35s var(--ease); }
@keyframes open { from { opacity: 0; transform: translateY(-6px); } }
.drawer .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.drawer h3 { margin: 0 0 8px; font: 500 0.75rem/1.2 var(--ui); color: var(--text-3); }
.heard { margin: 0 0 12px; color: var(--text-2); font-size: 0.875rem; line-height: 1.5; max-width: 62ch; }
.act { height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); color: var(--text-2); font-size: 0.8125rem; font-weight: 500; display: inline-flex; align-items: center; gap: 7px; transition: background-color 0.2s, color 0.2s; }
.act:hover { background: var(--glass-hover); color: var(--text); }
.act.danger:hover { color: var(--bad); }
.act.primary { background: var(--text); color: var(--ground); border-color: var(--text); }
.act svg { width: 16px; height: 16px; }
.edit textarea { width: 100%; min-height: 96px; resize: vertical; border-radius: 12px; border: 1px solid var(--line); background: rgba(6, 9, 18, 0.5); padding: 12px; font: 400 1.0625rem/1.42 var(--voice); margin-bottom: 10px; }

/* tags editor */
.tags-panel { margin: 0 var(--pad) 14px; padding: 14px; border-radius: 16px; background: var(--glass); border: 1px solid var(--line); animation: open 0.35s var(--ease); }
.tag-edit { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.tag-edit input { flex: 1; min-width: 0; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: rgba(6, 9, 18, 0.5); padding: 0 12px; font-size: 1rem; }
.swatch { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); display: grid; place-items: center; flex: none; }
.swatch::after { content: ''; width: 14px; height: 14px; border-radius: 50%; background: var(--tag); }
.hint { color: var(--text-3); font-size: 0.75rem; margin: 10px 0 0; }

/* empty and setup */
.empty { padding: 9vh var(--pad) 0; max-width: 46ch; }
.empty h2 { font: 400 1.75rem/1.2 var(--voice); margin: 0 0 12px; text-wrap: balance; }
.empty p { color: var(--text-2); margin: 0 0 10px; }
.empty code, .hint code { font: 500 0.8125rem ui-monospace, 'SF Mono', Menlo, monospace; background: var(--glass); padding: 2px 6px; border-radius: 6px; overflow-wrap: anywhere; }

/* composer */
.composer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; padding: 10px var(--pad) calc(10px + env(safe-area-inset-bottom));
  background: var(--scrim); backdrop-filter: blur(22px) saturate(1.4); -webkit-backdrop-filter: blur(22px) saturate(1.4); border-top: 1px solid var(--line);
}
.composer form { max-width: 620px; margin: 0 auto; display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; min-height: 46px; max-height: 140px; resize: none; border-radius: 14px; border: 1px solid var(--line); background: var(--glass); padding: 11px 14px; font-size: 1rem; line-height: 1.4; field-sizing: content; }
.send { width: 46px; height: 46px; border-radius: 14px; background: var(--text); color: var(--ground); display: grid; place-items: center; transition: transform 0.2s var(--ease), opacity 0.2s; }
.send:active { transform: scale(0.94); }
.send[disabled] { opacity: 0.35; cursor: default; }

.toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 6; background: #1a2036; border: 1px solid var(--line-strong); padding: 10px 14px; border-radius: 12px; font-size: 0.8125rem; display: flex; gap: 14px; align-items: center; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45); animation: open 0.3s var(--ease); max-width: calc(100vw - 32px); }
.toast button { color: var(--text); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* sign in */
.signin { min-height: 100dvh; display: grid; place-content: center; padding: var(--pad); gap: 14px; width: min(100%, 360px); margin: 0 auto; }
.signin h1 { font: 400 2rem/1.1 var(--voice); margin: 0 0 6px; }
.signin input { height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--glass); padding: 0 14px; font-size: 1rem; width: 100%; }
.signin .act { height: 48px; justify-content: center; font-size: 0.9375rem; }
.signin .err { color: #ff8fa3; font-size: 0.8125rem; min-height: 1.2em; margin: 0; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (min-width: 700px) {
  .top { padding-top: 40px; }
  .idea .words { font-size: 1.1875rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
