/* Brain Dump: retro, sleek, purple and pink */

/* Drop Advercase into /fonts as advercase.woff2 and it will be used for headings automatically. */
@font-face {
  font-family: 'Advercase';
  src: url('fonts/advercase.woff2') format('woff2');
  font-display: swap;
}

:root {
  --paper: #F5EFE6;
  --card: #FFFBF6;
  --ink: #24122E;
  --ink-soft: #5E4A6B;
  --line: #E4D9CF;
  --plum: #4B2366;
  --purple: #7B4FC4;
  --pink: #EE5FA0;
  --pink-soft: #F9D3E4;
  --lilac: #E7DDF6;
  --shadow: 0 1px 0 rgba(36, 18, 46, .06), 0 8px 24px -12px rgba(36, 18, 46, .25);
  --display: 'Advercase', 'Bowlby One', 'Arial Black', sans-serif;
  --script: 'Yellowtail', 'Brush Script MT', cursive;
  --body: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius: 18px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);

  --c-todo: #7B4FC4; --c-groceries: #E8618C; --c-shopping: #F29E4C; --c-dates: #4D3A9E;
  --c-calls: #D44FA0; --c-money: #3F9C7A; --c-home: #B38B5D; --c-family: #F27A6B;
  --c-health: #4F9CC4; --c-work: #6A5C80; --c-business: #C23E8C; --c-media: #9C6ADE; --c-thoughts: #A795C4;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1A0E22;
    --card: #251531;
    --ink: #F5EFE6;
    --ink-soft: #BFAFCB;
    --line: #3A2748;
    --plum: #E7DDF6;
    --pink-soft: #4A1E39;
    --lilac: #33204A;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 10px 28px -14px rgba(0, 0, 0, .7);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.app { min-height: 100%; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; }

/* ---------- Header ---------- */
.top { position: sticky; top: 0; z-index: 5; background: var(--paper); padding-top: var(--safe-t); }
.checker {
  height: 10px;
  background: repeating-conic-gradient(var(--plum) 0 25%, transparent 0 50%) 0 0 / 10px 10px;
  opacity: .9;
}
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 12px; border-bottom: 1px solid var(--line); }
.brand { display: flex; flex-direction: column; line-height: 1; }
.wordmark { font-family: var(--display); font-size: 26px; letter-spacing: .01em; text-transform: uppercase; color: var(--plum); }
.script { font-family: var(--script); font-size: 18px; color: var(--pink); margin-top: 2px; margin-left: 2px; }

.sync-pill {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--card);
  padding: 7px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--ink-soft); white-space: nowrap;
}
.sync-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-soft); opacity: .5; }
.sync-pill[data-state="synced"] .dot { background: #3F9C7A; opacity: 1; }
.sync-pill[data-state="syncing"] .dot { background: var(--purple); opacity: 1; animation: pulse 1s infinite; }
.sync-pill[data-state="waiting"] .dot { background: #F29E4C; opacity: 1; }
.sync-pill[data-state="reconnect"] { border-color: var(--pink); color: var(--pink); }
.sync-pill[data-state="reconnect"] .dot { background: var(--pink); opacity: 1; }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- Layout ---------- */
main { flex: 1; padding: 16px 16px calc(96px + var(--safe-b)); }
.view { animation: in .18s ease-out; }
@keyframes in { from { opacity: 0; transform: translateY(4px); } }

h2 { font-family: var(--display); font-weight: 400; text-transform: uppercase; font-size: 18px; letter-spacing: .02em; margin: 0; color: var(--plum); }
h3 { margin: 0 0 6px; font-size: 16px; font-weight: 700; }

/* ---------- Dump card ---------- */
.dump-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 16px 14px; }
.dump-label { display: block; font-family: var(--display); font-size: 30px; line-height: 1.05; text-transform: uppercase; color: var(--plum); }
.dump-sub { margin: 6px 0 12px; color: var(--ink-soft); font-size: 14.5px; }
textarea {
  width: 100%; resize: none; border: 1.5px solid var(--line); border-radius: 14px; background: var(--paper);
  padding: 14px; font-size: 17px; line-height: 1.5; min-height: 132px; outline: none; transition: border-color .15s;
}
textarea:focus { border-color: var(--purple); }
textarea::placeholder { color: var(--ink-soft); opacity: .6; }
.dump-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.dump-hint { font-size: 12.5px; color: var(--ink-soft); }

.btn-primary {
  border: 0; border-radius: 999px; background: var(--pink); color: #fff; font-weight: 700; padding: 13px 24px;
  font-size: 16px; letter-spacing: .01em; box-shadow: 0 2px 0 #B83E78; transition: transform .08s, opacity .15s; flex-shrink: 0;
}
.btn-primary:active { transform: translateY(2px); box-shadow: none; }
.btn-primary:disabled { opacity: .4; }
.btn-ghost { border: 1.5px solid var(--line); background: transparent; border-radius: 999px; padding: 11px 18px; font-weight: 600; font-size: 15px; }
.btn-ghost.danger, .link-btn.danger { color: #C23E5A; }
.link-btn { border: 0; background: none; padding: 6px 0; color: var(--purple); font-weight: 600; font-size: 14px; }

/* ---------- Just filed ---------- */
.just-filed { margin-top: 14px; background: var(--lilac); border-radius: var(--radius); padding: 14px; }
.just-filed h4 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); }
.just-filed ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.just-filed li { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--card); border-radius: 12px; padding: 10px 12px; }
.just-filed .jf-text { font-size: 15px; overflow-wrap: anywhere; }

/* ---------- Chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 5px 10px 5px 8px; font-size: 12.5px;
  font-weight: 700; white-space: nowrap; border: 1.5px solid color-mix(in srgb, var(--c, var(--purple)) 40%, transparent);
  background: color-mix(in srgb, var(--c, var(--purple)) 12%, var(--card)); color: var(--ink);
}
.chip::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--purple)); }
button.chip { cursor: pointer; }
button.chip.change::after { content: '\25BE'; font-size: 10px; opacity: .6; }
.chip.on { background: var(--c); color: #fff; border-color: var(--c); }
.chip.on::before { background: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips .chip { padding: 8px 13px 8px 10px; font-size: 14px; }

[data-cat="todo"] { --c: var(--c-todo); } [data-cat="groceries"] { --c: var(--c-groceries); }
[data-cat="shopping"] { --c: var(--c-shopping); } [data-cat="dates"] { --c: var(--c-dates); }
[data-cat="calls"] { --c: var(--c-calls); } [data-cat="money"] { --c: var(--c-money); }
[data-cat="home"] { --c: var(--c-home); } [data-cat="family"] { --c: var(--c-family); }
[data-cat="health"] { --c: var(--c-health); } [data-cat="work"] { --c: var(--c-work); }
[data-cat="business"] { --c: var(--c-business); } [data-cat="media"] { --c: var(--c-media); }
[data-cat="thoughts"] { --c: var(--c-thoughts); }

/* ---------- Lists ---------- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 2px 10px; }
.note-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.note {
  display: flex; align-items: flex-start; gap: 12px; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 12px 12px 10px;
}
.note-check {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--line); background: transparent;
  margin-top: 1px; display: grid; place-items: center; padding: 0;
}
.note-check.on { background: var(--purple); border-color: var(--purple); }
.note-check.on::after { content: ''; width: 10px; height: 6px; border: 2.5px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.note-body { flex: 1; min-width: 0; border: 0; background: none; text-align: left; padding: 0; }
.note-text { display: block; font-size: 16px; overflow-wrap: anywhere; }
.note-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 12.5px; color: var(--ink-soft); }
.note.is-done .note-text { text-decoration: line-through; color: var(--ink-soft); }
.empty { color: var(--ink-soft); font-size: 14.5px; text-align: center; padding: 18px 8px; margin: 0; }

/* ---------- Tiles ---------- */
.search-wrap { margin-bottom: 14px; }
input[type="search"] {
  width: 100%; border: 1.5px solid var(--line); background: var(--card); border-radius: 999px; padding: 12px 18px;
  font-size: 16px; outline: none; -webkit-appearance: none;
}
input[type="search"]:focus { border-color: var(--purple); }
#searchResults { margin-bottom: 18px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile {
  position: relative; text-align: left; border: 1px solid var(--line); background: var(--card); border-radius: var(--radius);
  padding: 14px 14px 13px; min-height: 104px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden;
}
.tile::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 5px; background: var(--c); }
.tile-count { font-family: var(--display); font-size: 30px; line-height: 1; color: var(--c); }
.tile-label { display: block; font-weight: 700; font-size: 15px; line-height: 1.2; }
.tile-peek { display: block; font-size: 12.5px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.tile.zero .tile-count { opacity: .35; }

/* ---------- Category view ---------- */
.cat-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.back-btn { border: 1px solid var(--line); background: var(--card); width: 40px; height: 40px; border-radius: 50%; font-size: 18px; flex-shrink: 0; }
#catTitle { font-size: 24px; line-height: 1.1; }
.cat-hint { margin: 3px 0 0; color: var(--ink-soft); font-size: 14px; }
.cat-foot { display: flex; justify-content: space-between; margin: 14px 2px 8px; }
.done-list { opacity: .85; }

/* ---------- Settings ---------- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.panel p { margin: 0 0 12px; color: var(--ink-soft); font-size: 14.5px; }
.panel p:last-child { margin-bottom: 0; }
.panel.quiet { background: transparent; }
.panel a { color: var(--purple); font-weight: 600; }
.panel a.btn-ghost { text-decoration: none; display: inline-flex; align-items: center; color: var(--ink); }
.panel .btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.google-btn {
  display: inline-flex; align-items: center; gap: 10px; border: 1.5px solid var(--line); background: #fff; color: #1f1f1f;
  border-radius: 999px; padding: 11px 18px; font-weight: 600; font-size: 15px;
}
.google-btn svg { width: 18px; height: 18px; }
.status-line { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 10px; font-size: 15px; }
.status-line .dot { width: 9px; height: 9px; border-radius: 50%; background: #3F9C7A; }
.status-line.off .dot { background: var(--ink-soft); opacity: .5; }
.tag-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; font-size: 14px; }
.tag-grid code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: var(--lilac); padding: 2px 6px; border-radius: 6px; color: var(--ink); }
.tag-grid span { color: var(--ink-soft); }

/* ---------- Install tip ---------- */
.install-tip { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; background: var(--pink-soft); border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; }
.install-tip p { margin: 0; font-size: 14px; }

/* ---------- Tabs ---------- */
.tabs {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(12px + var(--safe-b)); z-index: 6;
  display: flex; gap: 4px; padding: 5px; border-radius: 999px; background: var(--ink); box-shadow: 0 12px 30px -10px rgba(36, 18, 46, .6);
}
.tab {
  display: inline-flex; align-items: center; gap: 7px; border: 0; background: transparent; color: var(--paper);
  padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: 14.5px; opacity: .7;
}
.tab[aria-current="page"] { background: var(--pink); color: #fff; opacity: 1; }
.tab-ico { width: 16px; height: 16px; display: inline-block; background: currentColor; -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat; }
.ico-dump { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E"); }
.ico-sorted { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='3' y='3' width='8' height='8' rx='2'/%3E%3Crect x='13' y='3' width='8' height='8' rx='2'/%3E%3Crect x='3' y='13' width='8' height='8' rx='2'/%3E%3Crect x='13' y='13' width='8' height='8' rx='2'/%3E%3C/svg%3E"); }
.ico-settings { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M4 7h10M18 7h2M4 17h4M12 17h8'/%3E%3Ccircle cx='16' cy='7' r='2'/%3E%3Ccircle cx='10' cy='17' r='2'/%3E%3C/svg%3E"); }
@media (prefers-color-scheme: dark) { .tabs { background: #F5EFE6; } .tab { color: #24122E; } .tab[aria-current="page"] { color: #fff; } }

/* ---------- Bottom sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(20, 8, 28, .45); z-index: 10; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 11; max-width: 560px; margin: 0 auto; background: var(--card);
  border-radius: 24px 24px 0 0; padding: 10px 16px calc(18px + var(--safe-b)); max-height: 88vh; overflow: auto;
  animation: up .2s ease-out;
}
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.sheet-grip { width: 42px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
.sheet h3 { font-family: var(--display); font-weight: 400; text-transform: uppercase; font-size: 18px; color: var(--plum); margin-bottom: 12px; }
.sheet textarea { min-height: 84px; }
.sheet-label { margin: 14px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); font-weight: 600; }
.sheet-actions { display: flex; gap: 8px; margin-top: 18px; }
.sheet-actions .btn-primary { margin-left: auto; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + var(--safe-b)); z-index: 12;
  background: var(--ink); color: var(--paper); padding: 11px 16px; border-radius: 14px; font-size: 14.5px; font-weight: 500;
  max-width: calc(100% - 32px); display: flex; gap: 14px; align-items: center; animation: up .18s ease-out;
}
.toast button { border: 0; background: none; color: var(--pink); font-weight: 700; padding: 0; }

@media (min-width: 480px) { .tiles { grid-template-columns: 1fr 1fr 1fr; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Mic ---------- */
.mic-btn {
  display: inline-flex; align-items: center; gap: 8px; border: 1.5px solid var(--line); background: var(--paper);
  border-radius: 999px; padding: 11px 16px 11px 12px; font-weight: 700; font-size: 15px; color: var(--plum);
}
.mic-ico { width: 26px; height: 26px; border-radius: 50%; background: var(--pink); position: relative; flex-shrink: 0; }
.mic-ico::before { content: ''; position: absolute; inset: 5px 8px; background: #fff;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 12'%3E%3Crect x='1.5' width='5' height='8' rx='2.5'/%3E%3Crect x='3.4' y='9' width='1.2' height='3'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 12'%3E%3Crect x='1.5' width='5' height='8' rx='2.5'/%3E%3Crect x='3.4' y='9' width='1.2' height='3'/%3E%3C/svg%3E") center / contain no-repeat; }
.mic-btn[aria-pressed="true"] { background: var(--pink); border-color: var(--pink); color: #fff; }
.mic-btn[aria-pressed="true"] .mic-ico { background: #fff; animation: micpulse 1.2s ease-in-out infinite; }
.mic-btn[aria-pressed="true"] .mic-ico::before { background: var(--pink); }
@keyframes micpulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,.7); } 50% { box-shadow: 0 0 0 7px rgba(255,255,255,0); } }

/* ---------- Google card on the main screen ---------- */
.g-card { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 16px; margin-top: 14px; position: relative; overflow: hidden; }
.g-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 6px; background: repeating-conic-gradient(var(--pink) 0 25%, transparent 0 50%) 0 0 / 6px 6px; opacity: .8; }
.g-eyebrow { margin: 4px 0 4px; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--pink); }
.g-card h3 { font-size: 18px; line-height: 1.25; margin: 0 0 12px; color: var(--plum); text-wrap: balance; }
.g-steps { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.g-steps li { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.g-steps li span { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; background: var(--lilac); color: var(--plum); font-weight: 700; font-size: 12.5px; display: grid; place-items: center; margin-top: 1px; }
.g-note { margin: 0 0 14px; font-size: 13.5px; color: var(--ink-soft); background: var(--paper); border-radius: 12px; padding: 10px 12px; }
.g-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.g-line { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--ink-soft); background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; margin-top: 14px; }
.g-line span:nth-child(2) { flex: 1; min-width: 0; }
.g-line a, .g-line button { border: 0; background: none; padding: 0; color: var(--purple); font-weight: 700; font-size: 13.5px; text-decoration: none; white-space: nowrap; }
.g-dot { width: 9px; height: 9px; border-radius: 50%; background: #3F9C7A; flex-shrink: 0; }
.g-line.off .g-dot { background: #F29E4C; }

/* ---------- Your lists (main screen) ---------- */
.home-lists { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.home-list {
  display: flex; align-items: center; gap: 10px; text-align: left; border: 1px solid var(--line); background: var(--card);
  border-radius: 14px; padding: 13px 12px; min-height: 52px;
}
.home-list:active { transform: scale(.98); }
.home-list-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--purple)); flex-shrink: 0; }
.home-list-name { flex: 1; min-width: 0; font-weight: 700; font-size: 14.5px; line-height: 1.2; }
.home-list-count { font-family: var(--display); font-size: 18px; color: var(--c, var(--purple)); font-variant-numeric: tabular-nums; }
