/* Direction C: Cards */

:root {
  --base: #E6E4EB;
  --base-2: #DAD7E1;
  --paper: #FAF9FB;
  --ink: #211B27;
  --ink-2: #574F60;
  --ink-3: #8A8293;
  --line: #CCC7D4;

  --plum: #5A2A6C;
  --on-plum: #FFFFFF;
  --on-plum-2: #E4D3EC;
  --butter: #F3CF4F;
  --on-butter: #2A2210;
  --on-butter-2: #5B4B16;
  --slip: #FFF8DA;
  --moss: #46613A;
  --on-moss: #FFFFFF;
  --on-moss-2: #DCE8CF;
  --sage: #CBD8B8;
  --on-sage: #1F2A17;
  --on-sage-2: #45553A;
  --tomato: #C23A2B;
  --on-tomato: #FFFFFF;
  --on-tomato-2: #FAD9D3;
  --lilac: #DCCDEB;
  --on-lilac: #2B1A38;

  --add-bg: #E2ECD5;
  --add-ink: #2F4824;
  --code-bg: #2B2033;

  --focus: #2F6BFF;

  --r-xl: 34px;
  --r-l: 26px;
  --r-m: 20px;
  --r-s: 14px;

  --mb: 44px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);

  --f-ui: "Figtree", system-ui, sans-serif;
  --f-title: "Young Serif", Georgia, serif;
  --f-read: "Literata", Georgia, serif;
  --f-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --base: #211B27;
  --base-2: #3A3143;
  --paper: #2A2330;
  --ink: #F2EEF5;
  --ink-2: #BDB4C6;
  --ink-3: #8F8699;
  --line: #43394B;

  --plum: #7A3F92;
  --on-plum-2: #EBDDF2;
  --butter: #F0CB4A;
  --slip: #FFF6D0;
  --moss: #557548;
  --on-moss-2: #E2EED5;
  --sage: #3B4A31;
  --on-sage: #E6F0D9;
  --on-sage-2: #BFD0AD;
  --tomato: #CC4432;
  --on-tomato-2: #FFE1DB;
  --lilac: #4A3A5C;
  --on-lilac: #F0E6F8;

  --add-bg: #31402A;
  --add-ink: #D8EBC5;
  --code-bg: #17121C;

  --focus: #8FB0FF;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html.shot { --mb: 0px; }
body {
  margin: 0;
  background: var(--base);
  color: var(--ink);
  font-family: var(--f-ui);
  font-size: 16px;
  line-height: 1.45;
  padding-top: var(--sat);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
kbd {
  font-family: var(--f-ui);
  font-size: 12px; font-weight: 600;
  padding: 2px 6px; border-radius: 6px;
  background: color-mix(in srgb, currentColor 12%, transparent);
}
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--f-mono); font-size: .86em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 10px; }

@media (max-width: 899.98px) { .desk-only { display: none !important; } }
@media (min-width: 900px) { .mob-only { display: none !important; } }

/* ---------- mock switcher ---------- */
.mockbar {
  height: var(--mb);
  display: flex; align-items: stretch; justify-content: center;
  padding: 0 calc(8px + var(--sar)) 0 calc(8px + var(--sal));
  background: var(--ink);
  color: var(--base);
  font-size: 12.5px;
  position: relative; z-index: 60;
}
html.shot .mockbar { display: none; }
.mockbar-label { display: none; align-self: center; margin-right: 12px; opacity: .7; }
.mockbar a {
  flex: 1 1 0; max-width: 120px;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  opacity: .72; border-bottom: 3px solid transparent;
}
.mockbar a b { font-weight: 700; }
.mockbar a[aria-current="page"] { opacity: 1; border-bottom-color: var(--butter); }
.mockbar a:focus-visible { outline-offset: -3px; }
@media (min-width: 900px) { .mockbar-label { display: inline; } .mockbar { justify-content: flex-start; } }

/* ---------- shared bits ---------- */
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--base-2);
}
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }

.plus {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--on-butter);
  position: relative; flex: none;
}
.plus::before, .plus::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 14px; height: 2.5px; border-radius: 2px;
  background: var(--butter);
  transform: translate(-50%, -50%);
}
.plus::after { transform: translate(-50%, -50%) rotate(90deg); }

.back-btn {
  display: inline-flex; align-items: center; gap: 4px;
  height: 44px; padding: 0 14px 0 8px; border-radius: 22px;
  font-weight: 600; color: var(--ink-2);
}
.back-btn:hover { background: var(--base-2); color: var(--ink); }
.back-btn.on-color { color: var(--on-tomato); }
.back-btn.on-color:hover { background: rgb(255 255 255 / .14); color: var(--on-tomato); }

/* ---------- NOW ---------- */
.view-now {
  padding: 0 var(--sar) calc(116px + var(--sab)) var(--sal);
}
.now-head {
  display: flex; flex-direction: column-reverse; gap: 6px;
  padding: 14px 16px 18px;
}
.now-tools { display: flex; gap: 8px; align-items: center; }
.search-field {
  flex: 1; height: 48px; border-radius: 24px;
  display: flex; align-items: center; gap: 10px; padding: 0 16px;
  background: var(--base-2); color: var(--ink-2); font-weight: 500;
}
.search-field svg { width: 20px; height: 20px; }
.search-field kbd { margin-left: auto; }
.now-title { padding-top: 14px; }
.now-date { margin: 0; color: var(--ink-2); font-weight: 500; font-size: 15px; }
.now-h1 {
  margin: 2px 0 0;
  font-family: var(--f-title); font-weight: 400;
  font-size: 40px; line-height: 1.05; letter-spacing: -.01em;
}

.now-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  padding: 0 16px;
}
.card {
  position: relative;
  display: flex; flex-direction: column;
  border-radius: var(--r-l);
  padding: 20px;
  transition: transform .18s cubic-bezier(.3,.7,.4,1.4);
  min-width: 0;
}
a.card:active, .c-shop:has(.shop-title:active) { transform: scale(.975); }
.c-title {
  font-family: var(--f-title); font-weight: 400;
  font-size: 24px; line-height: 1.12; letter-spacing: -.005em;
}
.c-kicker {
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
  font-size: 14px; font-weight: 600;
}
.c-when { font-weight: 500; opacity: .85; }
.c-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }

/* next step strip, reused */
.next {
  display: flex; gap: 12px; align-items: flex-start;
  margin-top: auto; padding-top: 18px;
  font-weight: 600; font-size: 17px; line-height: 1.3;
}
.next-dot {
  width: 24px; height: 24px; border-radius: 50%;
  border: 2.5px solid currentColor; margin-top: 2px; flex: none;
}
.next-label { display: block; font-size: 13.5px; font-weight: 500; opacity: .85; margin-bottom: 1px; }

/* continue: the biggest thing */
.c-cont {
  grid-column: span 2;
  background: var(--plum); color: var(--on-plum);
  border-radius: var(--r-xl);
  min-height: 290px; padding: 22px 22px 24px;
}
.c-cont .c-kicker { color: var(--on-plum-2); }
.c-cont .c-title { font-size: 34px; line-height: 1.06; margin-top: 18px; text-wrap: balance; }
.c-cont .next {
  margin-left: -8px; margin-right: -8px; margin-bottom: -8px;
  padding: 14px 16px; border-radius: 20px;
  background: rgb(255 255 255 / .12);
}
.c-excerpt { font-family: var(--f-read); font-size: 19px; line-height: 1.55; color: var(--on-plum-2); max-width: 34em; margin-top: 18px; }

/* inbox: butter, a stack of paper slips */
.c-inbox {
  grid-column: span 2;
  background: var(--butter); color: var(--on-butter);
  border-radius: var(--r-l);
  padding-bottom: 30px;
}
.c-inbox .c-title { font-size: 28px; }
.count { font-weight: 600; font-size: 15px; color: var(--on-butter-2); }
.count b {
  display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 8px;
  border-radius: 15px; background: var(--on-butter); color: var(--butter);
  font-size: 16px; margin-right: 4px;
}
.count.bump b { animation: bump .5s cubic-bezier(.3,.7,.4,1.6); }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }

.slips { position: relative; display: block; margin-top: 16px; }
.slip {
  position: relative; z-index: 2;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  background: var(--slip); color: #2A2210;
  border-radius: var(--r-s);
  padding: 14px 16px;
  font-size: 16.5px; font-weight: 500; line-height: 1.35;
}
.slip-time { font-size: 13.5px; color: #6A5A22; font-weight: 600; padding-top: 2px; }
.slip-text { overflow-wrap: anywhere; }
/* phone: first slip plus two paper edges behind it */
.slip:nth-child(n+2) { display: none; }
.slips::before, .slips::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: -7px; height: 20px;
  background: color-mix(in srgb, var(--slip) 72%, var(--butter));
  border-radius: 0 0 var(--r-s) var(--r-s); z-index: 1;
}
.slips::after { left: 22px; right: 22px; bottom: -13px; background: color-mix(in srgb, var(--slip) 45%, var(--butter)); z-index: 0; }
.slip.new { animation: slipIn .55s cubic-bezier(.2,.8,.3,1.25); }
@keyframes slipIn { from { transform: translateY(-40px) scale(.9) rotate(-3deg); opacity: 0; } to { transform: none; opacity: 1; } }

/* airi: tomato, with a stack edge */
.c-airi {
  background: var(--tomato); color: var(--on-tomato);
  border-radius: var(--r-m);
  margin-top: 10px;
  min-height: 190px;
}
.airi-edge, .airi-edge::before {
  position: absolute; left: 14px; right: 14px; top: -7px; height: 20px;
  border-radius: 14px 14px 0 0;
  background: color-mix(in srgb, var(--tomato) 62%, var(--base));
}
.airi-edge::before { content: ""; left: 12px; right: 12px; top: -6px; height: 12px; background: color-mix(in srgb, var(--tomato) 32%, var(--base)); }
.airi-line { margin-top: 8px; font-weight: 500; color: var(--on-tomato-2); font-size: 15.5px; line-height: 1.35; }
.airi-foot { margin-top: auto; padding-top: 14px; font-weight: 700; font-size: 15px; }

/* pinned: moss family */
.c-pott {
  grid-column: span 2;
  background: var(--moss); color: var(--on-moss);
  border-radius: var(--r-l);
}
.c-pott .c-kicker { color: var(--on-moss-2); }
.c-pott .c-title { margin-top: 12px; font-size: 27px; }
.pin-ic { position: absolute; top: 16px; right: 16px; opacity: .8; }
.pin-ic svg { width: 18px; height: 18px; }

.c-ideas {
  background: var(--sage); color: var(--on-sage);
  border-radius: var(--r-m);
  margin-top: 10px;
  min-height: 190px;
}
.c-ideas .c-title { padding-right: 18px; }
.ideas-line { margin-top: 8px; font-size: 15px; line-height: 1.35; color: var(--on-sage-2); font-weight: 500; }
.next-small { font-size: 15px; padding-top: 12px; gap: 9px; }
.next-small .next-dot { width: 19px; height: 19px; border-width: 2px; }

.c-shop {
  grid-column: span 2;
  background: var(--paper); color: var(--ink);
  border-radius: var(--r-m);
  border: 1.5px solid var(--line);
}
.shop-title { align-self: flex-start; padding-right: 26px; }
.shop-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; column-gap: 12px; }
.shop-list label, .tasks label {
  display: flex; align-items: center; gap: 12px;
  min-height: 44px; cursor: pointer;
}
.shop-list span { font-size: 16px; font-weight: 500; }

input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; margin: 0; flex: none;
  width: 24px; height: 24px; border-radius: 8px;
  border: 2px solid var(--ink-3);
  display: grid; place-items: center; cursor: pointer;
  transition: background .15s, border-color .15s;
}
input[type="checkbox"]::after {
  content: ""; width: 11px; height: 6px;
  border-left: 2.5px solid var(--paper); border-bottom: 2.5px solid var(--paper);
  transform: rotate(-45deg) translate(1px, -1px) scale(0);
  transition: transform .18s cubic-bezier(.3,.7,.4,1.6);
}
input[type="checkbox"]:checked { background: var(--moss); border-color: var(--moss); }
input[type="checkbox"]:checked::after { transform: rotate(-45deg) translate(1px, -1px) scale(1); }
input[type="checkbox"]:checked + span { color: var(--ink-2); text-decoration: line-through; text-decoration-thickness: 1.5px; }
input[type="checkbox"]:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* the one big joyful button on the phone */
.capture-pill {
  position: fixed; z-index: 30;
  left: 50%; bottom: calc(16px + var(--sab));
  transform: translateX(-50%);
  width: min(calc(100% - 32px), 380px); height: 68px;
  border-radius: 34px;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  background: var(--butter); color: var(--on-butter);
  font-weight: 800; font-size: 20px;
  box-shadow: 0 0 0 6px var(--base);
  transition: transform .18s cubic-bezier(.3,.7,.4,1.6);
}
.capture-pill:active { transform: translateX(-50%) scale(.94); }
.capture-pill .plus { width: 36px; height: 36px; }
.capture-pill .plus::before, .capture-pill .plus::after { width: 16px; height: 3px; }

.capture-btn {
  height: 52px; padding: 0 12px 0 10px; border-radius: 26px;
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--butter); color: var(--on-butter);
  font-weight: 800; font-size: 17px;
  transition: transform .18s cubic-bezier(.3,.7,.4,1.6);
}
.capture-btn:active { transform: scale(.95); }
.capture-btn kbd { background: rgb(42 34 16 / .12); }

@media (min-width: 900px) {
  .view-now { padding: 0 40px 36px; }
  .now-head {
    flex-direction: row; align-items: flex-end; justify-content: space-between;
    padding: 26px 0 22px; gap: 24px;
  }
  .now-title { padding-top: 0; }
  .now-h1 { font-size: 52px; }
  .now-tools { gap: 12px; }
  .search-field { width: 380px; flex: none; height: 52px; border-radius: 26px; }
  .icon-btn { width: 52px; height: 52px; }

  .now-grid {
    grid-template-columns: 1.2fr 1.2fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
    grid-template-areas:
      "cont cont inbox airi"
      "cont cont inbox shop"
      "pott pott ideas shop";
    gap: 16px; padding: 0;
    height: calc(100vh - var(--mb) - var(--sat) - 146px);
    min-height: 660px;
  }
  .c-cont, .c-inbox, .c-pott, .c-shop { grid-column: auto; }
  .c-cont { grid-area: cont; padding: 34px 36px 36px; }
  .c-cont .c-kicker { font-size: 16px; }
  .c-cont .c-title { font-size: 60px; line-height: 1.02; max-width: 11.5em; margin-top: 28px; }
  .c-cont .next { font-size: 21px; padding: 18px 20px; margin: auto -12px -12px; border-radius: 24px; }
  .c-cont .next .next-label { font-size: 15px; }
  .c-cont .next-dot { width: 28px; height: 28px; }
  .c-inbox { grid-area: inbox; padding-bottom: 22px; overflow: hidden; }
  .c-airi { grid-area: airi; margin-top: 0; min-height: 0; }
  .c-shop { grid-area: shop; }
  .c-pott { grid-area: pott; }
  .c-pott .c-title { font-size: 40px; }
  .c-pott .c-excerpt { color: var(--on-moss-2); margin-top: 10px; font-size: 18px; }
  .c-shop .shop-foot { display: block; margin-top: auto; padding-top: 12px; color: var(--ink-2); font-weight: 600; font-size: 15px; }
  .c-ideas { grid-area: ideas; margin-top: 0; min-height: 0; }
  .c-airi .c-title { font-size: 30px; }
  .airi-line { font-family: var(--f-title); font-size: 23px; line-height: 1.2; color: var(--on-tomato); margin-top: 10px; max-width: 12em; }
  .c-ideas .c-title { font-size: 27px; }
  .ideas-line { font-family: var(--f-read); font-size: 18px; line-height: 1.5; margin-top: 10px; }
  .shop-list { grid-template-columns: 1fr; }
  .shop-list label { min-height: 46px; }
  .shop-list span { font-size: 17px; }

  .slips { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
  .slips::before, .slips::after { display: none; }
  .slip:nth-child(n+2) { display: flex; }
  .slip:nth-child(n+5) { display: none; }
  .slip { font-size: 15.5px; padding: 12px 14px; }
  .slip:nth-child(2) { transform: rotate(.5deg); }
  .slip:nth-child(3) { transform: rotate(-.4deg); }
  .slip:nth-child(4) { transform: rotate(.3deg); }
  .airi-edge { display: none; }
  .c-airi { box-shadow: 0 -8px 0 -2px color-mix(in srgb, var(--tomato) 55%, var(--base)); margin-top: 8px; }
  .c-airi { margin-top: 10px; }
}
@media (min-width: 900px) and (max-height: 860px) {
  .slip:nth-child(n+4) { display: none; }
}

/* ---------- EDITOR ---------- */
.view-editor {
  min-height: calc(100vh - var(--mb) - var(--sat));
  background: var(--paper);
  padding: 0 calc(16px + var(--sar)) calc(130px + var(--sab)) calc(16px + var(--sal));
}
.ed-top {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; margin: 0 -8px;
  background: var(--paper);
}
.ed-status { color: var(--ink-3); font-size: 14px; padding-right: 8px; }
.doc {
  max-width: 680px; margin: 0 auto;
  font-family: var(--f-read); font-size: 18px; line-height: 1.65;
  color: var(--ink);
}
.doc-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0 14px; font-family: var(--f-ui); font-size: 13.5px; }
.tag { padding: 3px 10px; border-radius: 99px; background: var(--base-2); color: var(--ink-2); font-weight: 600; }
.doc-where { color: var(--ink-2); margin-left: 4px; }
.doc h1 {
  font-family: var(--f-title); font-weight: 400;
  font-size: 34px; line-height: 1.12; letter-spacing: -.01em;
  margin: 0 0 18px; text-wrap: balance;
}
.doc h2 {
  font-family: var(--f-read); font-weight: 600;
  font-size: 23px; line-height: 1.3; margin: 34px 0 6px;
}
.doc p { margin: 0 0 14px; }
.doc strong { font-weight: 600; }
.mk { color: var(--ink-3); opacity: .55; font-weight: 400; }
h1 .mk, h2 .mk { font-family: var(--f-mono); font-size: .62em; vertical-align: .18em; letter-spacing: -.04em; }
.mk-x { display: none; }
.ln { position: relative; border-radius: 8px; cursor: text; }
.ln.is-active .mk { opacity: 1; color: var(--plum); }
:root[data-theme="dark"] .ln.is-active .mk { color: #D5A6EA; }
.ln.is-active .mk-x { display: inline; }
.ln.is-active::before {
  content: ""; position: absolute; left: -12px; top: 4px; bottom: 4px; width: 3px; border-radius: 2px;
  background: var(--plum);
}
.caret {
  display: inline-block; width: 2px; height: 1.05em; margin-left: 2px;
  background: var(--plum); vertical-align: -.12em;
  animation: blink 1.2s infinite;
}
:root[data-theme="dark"] .caret, :root[data-theme="dark"] .ln.is-active::before { background: #D5A6EA; }
@keyframes blink { 0%, 55% { opacity: 1; } 60%, 95% { opacity: 0; } }

.doc code {
  font-family: var(--f-mono); font-size: .82em;
  padding: 2px 6px; border-radius: 6px;
  background: var(--base-2); color: var(--ink);
}
.tasks { list-style: none; padding: 0; margin: 4px 0 8px; }
.tasks label { align-items: flex-start; gap: 14px; padding: 7px 0; }
.tasks input { margin-top: 3px; }

.code {
  margin: 12px 0 18px; padding: 12px 18px 12px;
  background: var(--code-bg); color: #EDE6F2;
  border-radius: var(--r-s);
  font-family: var(--f-mono); font-size: 14px; line-height: 1.7;
  overflow-x: auto;
}
.code pre { margin: 0; font: inherit; }
.code pre code { background: none; padding: 0; font-size: inherit; color: inherit; }
.code-fence { display: block; color: #A99AB5; opacity: 1; line-height: 1.5; }
.t-obj { color: #F4B4A8; }
.t-fn { color: #BFDCA2; }
.t-str { color: #F3CF4F; }
.t-p { color: #B9ADC4; }
.t-id { color: #EDE6F2; }

.nextbar {
  position: fixed; z-index: 20;
  left: 50%; transform: translateX(-50%);
  bottom: calc(14px + var(--sab));
  width: min(calc(100% - 24px), 680px);
  display: flex; align-items: center; gap: 14px;
  padding: 12px 20px 12px 12px; border-radius: 26px;
  background: var(--plum); color: var(--on-plum);
  box-shadow: 0 0 0 10px var(--paper);
}
.nextbar-check {
  width: 48px; height: 48px; border-radius: 50%; flex: none;
  border: 2.5px solid var(--on-plum-2);
  display: grid; place-items: center;
  transition: background .2s, transform .2s cubic-bezier(.3,.7,.4,1.6);
}
.nextbar-check svg { opacity: 0; transform: scale(.4); transition: .2s; stroke-width: 3; }
.nextbar-check:active { transform: scale(.9); }
.nextbar.done .nextbar-check { background: var(--butter); border-color: var(--butter); color: var(--on-butter); }
.nextbar.done .nextbar-check svg { opacity: 1; transform: none; }
.nextbar.done .nextbar-step { text-decoration: line-through; opacity: .8; }
.nextbar-text { margin: 0; font-weight: 700; font-size: 17px; line-height: 1.3; }
.nextbar .next-label { color: var(--on-plum-2); }

@media (min-width: 900px) {
  .view-editor { padding-left: 40px; padding-right: 40px; }
  .ed-top { padding: 16px 0; margin: 0; }
  .doc { font-size: 19px; padding-top: 32px; }
  .doc h1 { font-size: 46px; margin-bottom: 26px; }
  .doc h2 { font-size: 25px; }
  .ln.is-active::before { left: -20px; }
  .ed-top .back-btn { opacity: .75; }
  .ed-top .back-btn:hover, .ed-top .back-btn:focus-visible { opacity: 1; }
}

/* ---------- AGENT ---------- */
.view-agent {
  padding: 0 calc(16px + var(--sar)) calc(28px + var(--sab)) calc(16px + var(--sal));
}
.ag-panel {
  background: var(--tomato); color: var(--on-tomato);
  margin: 0 -16px; padding: 4px 20px 22px;
  border-radius: 0 0 var(--r-l) var(--r-l);
}
.ag-top { margin: 0 -10px; padding-top: 4px; }
.ag-h { font-family: var(--f-title); font-weight: 400; font-size: 29px; line-height: 1.1; margin: 4px 0 4px; }
.ag-sub { margin: 0; color: var(--on-tomato-2); font-weight: 600; font-size: 16px; }
.ag-main { padding-top: 30px; }

.stack { display: grid; position: relative; touch-action: pan-y; padding-top: 0; }
.sc {
  grid-area: 1 / 1;
  display: flex; flex-direction: column;
  border-radius: var(--r-l);
  padding: 20px;
  transition: transform .36s cubic-bezier(.2,.8,.25,1), opacity .3s;
  transform-origin: 50% 0;
  min-width: 0;
  user-select: none; -webkit-user-select: none;
}
.sc[data-pos="0"] { z-index: 5; }
.sc[data-pos="1"] { z-index: 4; transform: translateY(-13px) scale(.95); }
.sc[data-pos="2"] { z-index: 3; transform: translateY(-24px) scale(.9); }
.sc[data-pos="rest"] { z-index: 1; transform: translateY(-24px) scale(.9); opacity: 0; }
.sc:not([data-pos="0"]) > * { visibility: hidden; }
.sc[data-pos="gone"] { z-index: 6; transform: translateX(-118%) rotate(-10deg); opacity: 0; pointer-events: none; }
.sc.dragging { transition: none !important; cursor: grabbing; }

.sc-paper { background: var(--paper); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.sc-moss { background: var(--moss); color: var(--on-moss); }
.sc-lilac { background: var(--lilac); color: var(--on-lilac); }
.sc-sage { background: var(--sage); color: var(--on-sage); }
.sc-butter { background: var(--butter); color: var(--on-butter); }

.sc-kind { margin: 0 0 12px; font-weight: 700; font-size: 15px; }
.sc-quote {
  margin: 0; padding: 12px 14px; border-radius: var(--r-s);
  background: color-mix(in srgb, currentColor 9%, transparent);
  font-family: var(--f-title); font-size: 19px; line-height: 1.3;
  overflow-wrap: anywhere;
}
.sc-quote span { display: block; font-family: var(--f-ui); font-size: 13.5px; font-weight: 500; opacity: .8; margin-top: 6px; }
.sc-what { margin: 14px 0 0; font-size: 16.5px; line-height: 1.4; }
.sc-what b, .sc-link b { font-weight: 700; }
.sc-link { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0 0; font-size: 15.5px; line-height: 1.4; }
.sc-link svg { width: 19px; height: 19px; margin-top: 1px; }
.sc-summary { margin: 10px 0 0; font-family: var(--f-read); font-style: italic; font-size: 17px; line-height: 1.55; }
.sc-airi { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0 0; font-weight: 600; font-size: 17px; line-height: 1.35; }
.airi-av {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--tomato); color: var(--on-tomato);
  font-family: var(--f-title); font-size: 16px;
}
.sc-answers { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.answer {
  min-height: 44px; padding: 0 18px; border-radius: 22px;
  background: var(--on-butter); color: var(--butter); font-weight: 700;
}
.answer[aria-pressed="true"] { background: var(--paper); color: var(--ink); }

.sc-foot {
  margin-top: auto; padding-top: 16px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
}
.commit { margin: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; line-height: 1.35; min-width: 0; }
.commit-msg { font-weight: 600; font-size: 14.5px; }
.commit-meta, .commit-rev { opacity: .85; }
.commit code { font-size: 12.5px; }
.undo-btn {
  flex: none; min-height: 48px; padding: 0 24px; border-radius: 24px;
  background: var(--ink); color: var(--paper);
  font-weight: 800; font-size: 16px;
  transition: transform .18s cubic-bezier(.3,.7,.4,1.6);
}
.undo-btn:active { transform: scale(.94); }
.sc-moss .undo-btn { background: var(--on-moss); color: var(--moss); }
:root[data-theme="dark"] .sc-lilac .undo-btn, :root[data-theme="dark"] .sc-sage .undo-btn { background: var(--ink); color: var(--base); }
.undo-btn[data-state="undone"] { background: transparent; color: inherit; box-shadow: inset 0 0 0 2px currentColor; }

.diff { margin-top: 14px; border-radius: var(--r-s); overflow: hidden; box-shadow: inset 0 0 0 1.5px var(--line); }
.diff-head {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 8px 12px; background: var(--base-2); font-size: 13px;
}
.diff-head .mono { font-size: 12.5px; color: var(--ink-2); }
.diff-state { font-weight: 700; color: var(--add-ink); font-size: 13px; }
.diff-body { margin: 0; padding: 6px 0; font-family: var(--f-mono); font-size: 13.5px; line-height: 1.75; white-space: normal; overflow-x: auto; }
.dl { display: block; white-space: pre; padding: 0 12px; min-height: 1.75em; transition: background .25s, color .25s, opacity .25s; }
.dl i { font-style: normal; display: inline-block; width: 1.4em; color: var(--ink-3); }
.dl.add { background: var(--add-bg); color: var(--add-ink); }
.dl.add i { color: var(--add-ink); font-weight: 700; }
.diff.undone .dl.add { background: transparent; color: var(--ink-3); text-decoration: line-through; }
.diff.undone .diff-state { color: var(--tomato); }
:root[data-theme="dark"] .diff.undone .diff-state { color: #FF9C8C; }

.stack-nav { display: flex; align-items: center; justify-content: center; gap: 20px; margin-top: 16px; }
.nav-btn { width: 52px; height: 52px; border-radius: 50%; background: var(--base-2); display: grid; place-items: center; }
.nav-btn:disabled { opacity: .35; cursor: default; }
.stack-count { margin: 0; font-weight: 700; min-width: 4.5em; text-align: center; }
.stack-hint { text-align: center; color: var(--ink-2); font-size: 14px; margin: 6px 0 0; }

@media (min-width: 900px) {
  .view-agent {
    display: grid; grid-template-columns: 440px 1fr;
    min-height: calc(100vh - var(--mb) - var(--sat));
    padding: 0;
  }
  .ag-panel { margin: 0; border-radius: 0; padding: 22px 34px 34px; display: flex; flex-direction: column; }
  .ag-top { margin: 0 0 30px -12px; }
  .ag-h { font-size: 42px; line-height: 1.06; }
  .ag-sub { font-size: 18px; margin-top: 8px; }
  .ag-list { list-style: none; padding: 0; margin: 34px -12px 0; display: grid; gap: 4px; }
  .ag-list button {
    width: 100%; display: flex; gap: 14px; align-items: center; text-align: left;
    padding: 10px 12px; border-radius: 16px; min-height: 60px;
  }
  .ag-list button:hover { background: rgb(255 255 255 / .1); }
  .ag-list button[aria-current="true"] { background: rgb(255 255 255 / .18); }
  .ag-list b { display: block; font-weight: 700; font-size: 15.5px; line-height: 1.25; }
  .ag-list small { display: block; font-size: 14px; color: var(--on-tomato-2); }
  .sw { width: 26px; height: 34px; border-radius: 8px; flex: none; }
  .sw-paper { background: var(--paper); }
  .sw-moss { background: var(--moss); box-shadow: inset 0 0 0 1.5px rgb(255 255 255 / .35); }
  .sw-lilac { background: var(--lilac); }
  .sw-sage { background: var(--sage); }
  .sw-butter { background: var(--butter); }
  .ag-note { margin-top: auto; padding-top: 24px; font-size: 15px; line-height: 1.5; color: var(--on-tomato-2); max-width: 30em; }
  .ag-main { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 60px 48px 40px; }
  .stack { width: 100%; max-width: 640px; }
  .sc { padding: 30px 32px; border-radius: var(--r-xl); min-height: 560px; }
  .sc-quote { font-size: 23px; padding: 16px 18px; }
  .sc-what { font-size: 18px; }
  .diff-body { font-size: 14.5px; }
}

/* ---------- OVERLAYS: capture and search ---------- */
.overlay { position: fixed; inset: calc(var(--mb) + var(--sat)) 0 0 0; z-index: 40; }
.backdrop { position: absolute; inset: 0; background: rgb(33 27 39 / .5); display: none; }
.sheet { position: absolute; inset: 0; display: flex; flex-direction: column; }

.capture {
  background: var(--butter); color: var(--on-butter);
  padding: 10px calc(18px + var(--sar)) calc(18px + var(--sab)) calc(18px + var(--sal));
}
.cap-top { display: flex; justify-content: space-between; align-items: center; margin: 0 -6px; }
.icon-btn.on-butter { background: rgb(42 34 16 / .1); color: var(--on-butter); }
.cap-dest {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 14px 0 10px; border-radius: 18px;
  background: rgb(42 34 16 / .1); font-weight: 700; font-size: 14.5px;
}
.cap-dest svg { width: 19px; height: 19px; }
.cap-text {
  flex: 1; width: 100%; margin-top: 28px;
  border: 0; outline: 0; resize: none; background: transparent; color: var(--on-butter);
  font-family: var(--f-title); font-size: 38px; line-height: 1.15; letter-spacing: -.01em;
  caret-color: var(--tomato);
}
.cap-text::placeholder { color: rgb(42 34 16 / .45); }
.cap-text:focus-visible { outline: 0; }
.cap-text.sent { animation: sent .5s cubic-bezier(.5,0,.75,0) forwards; }
@keyframes sent { to { transform: translateY(140px) scale(.5); opacity: 0; } }
.cap-bottom { display: flex; flex-direction: column; gap: 14px; }
.cap-hint { margin: 0; font-weight: 600; font-size: 15px; color: var(--on-butter-2); }
.cap-hint kbd { background: rgb(42 34 16 / .1); }
.cap-go {
  height: 68px; border-radius: 34px;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  background: var(--on-butter); color: var(--butter);
  font-weight: 800; font-size: 21px;
  transition: transform .18s cubic-bezier(.3,.7,.4,1.6);
}
.cap-go:active { transform: scale(.95); }
.cap-go .plus { background: var(--butter); width: 34px; height: 34px; }
.cap-go .plus::before, .cap-go .plus::after { background: var(--on-butter); }
.cap-go kbd { background: rgb(243 207 79 / .18); color: var(--butter); margin-left: 4px; }

.search { background: var(--base); padding: 10px calc(16px + var(--sar)) var(--sab) calc(16px + var(--sal)); }
.search-bar {
  display: flex; align-items: center; gap: 10px;
  height: 56px; padding: 0 6px 0 16px; border-radius: 28px;
  background: var(--paper); box-shadow: inset 0 0 0 2px var(--ink);
}
.search-bar input {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--ink);
  font: 600 19px var(--f-ui);
}
.search-bar input::-webkit-search-cancel-button { display: none; }
.search-cancel { height: 44px; padding: 0 12px; border-radius: 22px; font-weight: 600; color: var(--ink-2); }
.results { flex: 1; overflow-y: auto; padding: 12px 0 24px; margin: 0 -4px; }
.r-group { margin: 14px 4px 6px; font-weight: 700; font-size: 14.5px; color: var(--ink-2); }
.r-item {
  display: flex; gap: 14px; align-items: flex-start; width: 100%; text-align: left;
  padding: 12px 12px; border-radius: 18px; min-height: 56px;
}
.r-item[aria-selected="true"] { background: var(--paper); box-shadow: inset 0 0 0 2px var(--ink); }
.r-tab { width: 10px; align-self: stretch; border-radius: 5px; flex: none; min-height: 36px; }
.r-tab.plum { background: var(--plum); }
.r-tab.moss { background: var(--moss); }
.r-tab.line { background: var(--line); }
.r-tab.tomato { background: var(--tomato); }
.r-tab.butter { background: var(--butter); }
.r-body { min-width: 0; flex: 1; }
.r-title { display: block; font-family: var(--f-title); font-size: 19px; line-height: 1.22; }
.r-meta { display: block; margin-top: 3px; font-size: 14px; color: var(--ink-2); }
.r-snip { display: block; margin-top: 4px; font-family: var(--f-read); font-size: 15.5px; color: var(--ink-2); line-height: 1.45; }
.r-item mark { background: var(--butter); color: var(--on-butter); border-radius: 4px; padding: 0 2px; }
.r-act .r-title { font-family: var(--f-ui); font-weight: 600; font-size: 16.5px; }
.r-icon { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--base-2); }
.r-icon svg { width: 19px; height: 19px; }
.r-kbd { margin-left: auto; align-self: center; color: var(--ink-2); }
.r-empty { padding: 30px 8px; color: var(--ink-2); font-size: 16px; }

@media (min-width: 900px) {
  .overlay { inset: calc(var(--mb) + var(--sat)) 0 0 0; }
  .backdrop { display: block; }
  .sheet { inset: auto; left: 50%; transform: translateX(-50%); }
  .capture {
    top: 12vh; width: 760px; height: 440px; border-radius: var(--r-xl);
    padding: 22px 30px 28px;
  }
  .cap-text { font-size: 44px; margin-top: 26px; }
  .cap-bottom { flex-direction: row; align-items: center; justify-content: space-between; gap: 24px; }
  .cap-hint { max-width: 380px; line-height: 1.5; }
  .cap-go { padding: 0 22px 0 18px; height: 60px; }
  .search {
    top: 9vh; width: 760px; max-height: 82vh; border-radius: var(--r-l);
    padding: 16px 16px 12px;
  }
  .search-bar { height: 60px; }
  .search-bar input { font-size: 21px; }
  .search-cancel { display: none; }
  .r-item:hover { background: color-mix(in srgb, var(--paper) 60%, transparent); }
  .search-foot { display: flex !important; gap: 20px; margin: 0; padding: 10px 6px 2px; font-size: 13.5px; color: var(--ink-2); border-top: 1.5px solid var(--line); }
  .search-foot kbd { margin-right: 3px; }
}

/* ---------- toast ---------- */
.toast {
  position: fixed; z-index: 70;
  left: 50%; bottom: calc(100px + var(--sab));
  transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 32px);
  display: flex; align-items: center; gap: 14px;
  padding: 10px 10px 10px 20px; border-radius: 22px;
  background: var(--ink); color: var(--base);
  font-weight: 600; font-size: 15.5px; line-height: 1.35;
  animation: toastIn .32s cubic-bezier(.2,.8,.3,1.3);
}
.toast button {
  min-height: 44px; padding: 0 16px; border-radius: 18px;
  background: var(--butter); color: var(--on-butter); font-weight: 800; flex: none;
}
.toast:not(:has(button:not([hidden]))) { padding-right: 20px; min-height: 56px; }
body[data-route="agent"] .toast { bottom: calc(24px + var(--sab)); }
@keyframes toastIn { from { transform: translate(-50%, 20px); opacity: 0; } }
@media (min-width: 900px) { .toast { bottom: 32px; } }
body[data-route="editor"] .toast { bottom: calc(104px + var(--sab)); }

/* ---------- view transition: card zooms into the editor ---------- */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .28s; }
::view-transition-group(note) { animation-duration: .42s; animation-timing-function: cubic-bezier(.2,.8,.25,1); }
::view-transition-old(note), ::view-transition-new(note) { height: 100%; object-fit: cover; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

.shop-foot { display: none; }
