/* The plain-whiteboard look: off-white, serif, no card chrome.
   Blocks are just text sitting on the surface until you touch them. */

:root {
  --paper: #f7f8f9;
  --ink: #14161a;
  --ink-soft: #6b7280;
  --ink-faint: #9ca3af;
  --line: #d8dbe0;
  --accent: #1f6feb;
  --ghost: #7c5cff;
  --serif: "Charter", "Bitstream Charter", "Sitka Text", Cambria, Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  /* What the morning brief wrote. Nav's own words stay in --serif. */
  --claude: "Geist", "Helvetica Neue", Helvetica, Arial, sans-serif;

  /* Editor and rendered view MUST share these, or text jumps on focus. */
  --block-font-size: 16px;
  --block-line-height: 1.5;
  --block-pad-y: 6px;
  --block-pad-x: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------------------ canvas */

#viewport {
  position: fixed;
  inset: 0;
  overflow: hidden;
  cursor: default;
}
#viewport.panning { cursor: grabbing; }
#viewport.space-held { cursor: grab; }
#viewport[data-tool='pan'] { cursor: grab; }
#viewport[data-tool='draw'] { cursor: crosshair; }
#viewport[data-tool='erase'] {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Ccircle cx='12' cy='12' r='9' fill='rgba(255,255,255,.65)' stroke='%23333' stroke-width='1.4'/%3E%3C/svg%3E") 12 12, crosshair;
}
#viewport[data-tool='text'] { cursor: text; }
#viewport[data-tool='draw'] .block,
#viewport[data-tool='erase'] .block,
#viewport[data-tool='pan'] .block { pointer-events: none; }
#viewport[data-tool='select'] .block { cursor: grab; }

#world {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  will-change: transform;
}

#arrows {
  position: absolute;
  overflow: visible;
  pointer-events: none;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
}
#arrow-paths path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#arrow-paths path.suggested {
  stroke: var(--ink-faint);
  stroke-dasharray: 5 5;
}
#arrowhead path { fill: var(--ink); }

#arrow-paths path.ink {
  fill: none;
  stroke: var(--ink);
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
#arrow-paths path.ink.selected {
  stroke: var(--accent);
  stroke-dasharray: 6 4;
}
#arrow-paths path.erasing {
  opacity: 0.22;
  stroke: #c2410c;
}

#blocks { position: absolute; left: 0; top: 0; }

/* ------------------------------------------------------------ blocks */

.block {
  position: absolute;
  padding: var(--block-pad-y) var(--block-pad-x);
  border-radius: 4px;
  border: 1px solid transparent;
  font-size: var(--block-font-size);
  line-height: var(--block-line-height);
  transition: border-color 0.09s, background 0.09s;
}

@media (hover: hover) { .block:hover { border-color: var(--line); } }

.block.selected {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.6);
}

.block.editing {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 1px 10px rgba(20, 22, 26, 0.07);
}

.block.flash {
  animation: flash 1.1s ease-out;
}
@keyframes flash {
  0%, 40% { background: rgba(31, 111, 235, 0.16); border-color: var(--accent); }
  100% { background: transparent; }
}

/* ⌥C tints. Soft enough that text stays the loudest thing on the card. */
#world .block[data-color='yellow'], #world.zoomed-out .block[data-color='yellow'] { background: #fdf6d8; }
#world .block[data-color='green'], #world.zoomed-out .block[data-color='green'] { background: #e6f4e8; }
#world .block[data-color='blue'], #world.zoomed-out .block[data-color='blue'] { background: #e5eefb; }
#world .block[data-color='red'], #world.zoomed-out .block[data-color='red'] { background: #fbe7e5; }
#world .block[data-color='purple'], #world.zoomed-out .block[data-color='purple'] { background: #efe9fb; }

/* Reserve & Dry Powder is a real region the app (and the AI) knows about. */
.block.kind-reserve {
  background: rgba(20, 22, 26, 0.028);
  border-color: var(--line);
}
.block.kind-day .rendered .header:first-child { letter-spacing: 0.01em; }


/* Yesterday's leftovers, offered beside today. Quiet until taken. */
.block.kind-carry {
  border: 1px dashed var(--line, #d8d4cc);
}
.block.kind-carry .rendered { opacity: 0.7; }

/* One element does both jobs: what you read and what you type into. That is
   the whole reason a heading is already a heading while you are typing it. */
.rendered {
  font-family: var(--serif);
  font-size: var(--block-font-size);
  line-height: var(--block-line-height);
  letter-spacing: normal;
  padding: 0;
  margin: 0;
  border: 0;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  width: 100%;
}

.block.editing .rendered { outline: none; cursor: text; }
/* The marks (**, [](), ~~) stay in the text but never on screen — typing in
   a block looks the same as reading it (Nav, 25 Oct). */
.rendered .mk { display: none; }

/* Who wrote it shows in the type: the brief's blocks and lines in Geist. */
.block.by-claude .rendered,
.rendered .line.by-claude,
#report-title,
#report-body .rendered { font-family: var(--claude); }

.rendered { min-height: calc(var(--block-font-size) * var(--block-line-height)); }
.rendered .line { display: block; min-height: 1.5em; }
.rendered .header { font-weight: 700; }
.rendered .bullet { padding-left: 1.05em; text-indent: -1.05em; }
.rendered .sub { padding-left: 2.3em; text-indent: -1.05em; }
.rendered .done { color: var(--ink-faint); text-decoration: line-through; text-decoration-thickness: 1px; }
.rendered .dropped { color: var(--ink-faint); }
.rendered a { color: var(--accent); }
.rendered .empty { visibility: hidden; }
.rendered code { font-family: var(--mono); font-size: 0.86em; background: #eef0f3; padding: 0 3px; border-radius: 3px; }
.rendered s { color: var(--ink-faint); }

/* Tables: ruled lines only, no fills. The header row is the one soft label. */
.rendered .tbl { display: table; border-collapse: collapse; width: 100%; margin: 0.35em 0 0.5em; white-space: normal; }
.rendered .line.trow { display: table-row; }
.rendered .line.tsep { display: none; }
/* A table never runs past its block: long words and code break inside the cell
   instead, and the cells read a step smaller than the prose around them. */
.rendered .tc { display: table-cell; padding: 0.3em 1em 0.3em 0; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 0.92em; overflow-wrap: anywhere; }
.rendered .tc code { white-space: normal; word-break: break-all; }
.rendered .tc:last-child { padding-right: 0; }
.rendered .thead .tc { color: var(--ink-soft); font-size: 0.8em; font-weight: 400; border-bottom-color: var(--ink-faint); }

/* Pictures: the width of the block, nothing around them. Click to enlarge. */
.rendered .line.pic { margin: 0.35em 0 0.5em; }
.rendered .pic img { display: block; width: 100%; height: auto; border-radius: 4px; cursor: zoom-in; }
#world.zoomed-out .block .pic img { opacity: 0.9; }

/* Flows: the steps in a row, the arrow the one touch of accent. */
.rendered .line.flow { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.15em 0.6em; margin: 0.35em 0 0.5em; white-space: normal; }
.rendered .flow .arr { color: var(--accent); }

/* Markdown headings. Bigger than the body, never so big the block jumps. */
.rendered .h1 { font-size: 1.42em; line-height: 1.25; margin: 0.15em 0 0.05em; }
.rendered .h2 { font-size: 1.22em; line-height: 1.3; margin: 0.12em 0 0.04em; }
.rendered .h3 { font-size: 1.08em; letter-spacing: 0.005em; }
.rendered .h4, .rendered .h5, .rendered .h6 { font-size: 1em; color: var(--ink-soft); }

/* —x— : the line that closes a task and numbers the next one. */
.rendered .rule {
  display: block;
  position: relative;
  height: 1.5em;
  min-height: 1.5em;
}
.rendered .rule::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 1px solid var(--line);
}
/* The number is for the day's tasks. On any other block a rule is just a rule. */
.rendered .rule::after {
  content: none;
}
.block.kind-day .rendered .rule::after {
  content: attr(data-n);
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: var(--paper);
  padding-left: 7px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-faint);
}
.block.kind-day.editing .rendered .rule::after, .block.kind-day.selected .rendered .rule::after { background: #fff; }

/* Thumbnails live inside the block. You never travel to a picture. */
.thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.thumb {
  max-width: 100%;
  max-height: 170px;
  border-radius: 3px;
  border: 1px solid var(--line);
  cursor: zoom-in;
  display: block;
}
.thumb.pending { opacity: 0.45; }

/* Drag handle for hand-drawing an arrow. Only shows on hover. */
.link-handle {
  position: absolute;
  right: -7px;
  top: 50%;
  width: 13px;
  height: 13px;
  margin-top: -6px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--paper);
  opacity: 0;
  cursor: crosshair;
  transition: opacity 0.1s;
}
.block.selected .link-handle { opacity: 1; }
@media (hover: hover) { .block:hover .link-handle { opacity: 1; } }

/* Bottom-right drag makes the box bigger. Same corner as every other box. */
.resize-handle {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 14px;
  height: 14px;
  cursor: nwse-resize;
  opacity: 0;
  transition: opacity 0.1s;
}
.resize-handle::after {
  content: "";
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--ink-faint);
  border-bottom: 2px solid var(--ink-faint);
  border-bottom-right-radius: 2px;
}
.resize-handle.left { right: auto; left: -2px; cursor: nesw-resize; }
.resize-handle.left::after {
  right: auto;
  left: 3px;
  border-right: 0;
  border-left: 2px solid var(--ink-faint);
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 2px;
}
.block.selected .resize-handle, .block.editing .resize-handle { opacity: 1; }
@media (hover: hover) { .block:hover .resize-handle { opacity: 1; } }
#world.zoomed-out .resize-handle { display: none; }

/* A finished day folds down to its date line. ⌘. toggles it. A block can hold
   several client headings; folded, only the first one — the title — shows. */
.block.collapsed .rendered .line:not(.header-line) { display: none; }
.block.collapsed .rendered .header-line ~ .header-line { display: none; }
.block.collapsed .thumbs { display: none; }
.block.collapsed {
  border-color: var(--line);
  border-style: dashed;
  color: var(--ink-soft);
  cursor: grab;
  min-height: 0 !important;
}
.block.collapsed::after {
  content: "…";
  color: var(--ink-faint);
  margin-left: 6px;
}

/* Yesterday, condensed: one line, its date, and a bar down the side. Days and
   parked plays both read as capsules — a thing you can open, not a thing gone. */
.block.kind-day.collapsed, .block.kind-parked.collapsed {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 5px;
  padding: 8px 12px;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(20, 22, 26, 0.05);
  white-space: nowrap;
  overflow: hidden;
}
.block.kind-parked.collapsed { border-left-color: var(--ghost); }
.block.kind-day.collapsed .rendered .header, .block.kind-parked.collapsed .rendered .header {
  font-weight: 500;
}
.block.kind-day.collapsed::after, .block.kind-parked.collapsed::after { content: none; }
.block.kind-parked { background: rgba(124, 92, 255, 0.04); }

/* Semantic zoom: pull back and every block becomes its header. */
#world.zoomed-out .block .rendered .line:not(.header-line) { display: none; }
#world.zoomed-out .block .rendered .header-line ~ .header-line { display: none; }
#world.zoomed-out .block .thumbs { display: none; }
#world.zoomed-out .block .rendered .header { font-size: 1.35em; }
#world.zoomed-out .block { border-color: var(--line); background: rgba(255, 255, 255, 0.55); }
#world.zoomed-out .link-handle { display: none; }

/* Except the day you are in. A day that has passed is a capsule with a date on
   it; the live one keeps every task on screen however far you pull back —
   zooming out is how you see the day whole, not how you lose it. */
#world.zoomed-out .block.kind-day.is-today:not(.collapsed) .rendered .line { display: block; }
#world.zoomed-out .block.kind-day.is-today:not(.collapsed) .rendered .line.rule { display: block; }
#world.zoomed-out .block.kind-day.is-today:not(.collapsed) .thumbs { display: flex; }
#world.zoomed-out .block.kind-day.is-today:not(.collapsed) .rendered .header { font-size: 1em; }
#world.zoomed-out .block.kind-day.is-today:not(.collapsed) .rendered .h1 { font-size: 1.42em; }
#world.zoomed-out .block.kind-day.is-today:not(.collapsed) .rendered .h2 { font-size: 1.22em; }
#world.zoomed-out .block.kind-day.is-today:not(.collapsed) .rendered .h3 { font-size: 1.08em; }
#world.zoomed-out .block.kind-day.is-today {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 2px 18px rgba(20, 22, 26, 0.08);
}

/* ------------------------------------------------------------ task canvases */

/* The chip a task wears once it has a canvas of its own. No text of its own —
   the line has to read back out of the DOM exactly as it was typed. */
.task-chip {
  display: inline-block;
  position: relative;
  width: 15px;
  height: 15px;
  margin-left: 7px;
  vertical-align: -2px;
  border: 1px solid var(--accent);
  border-radius: 3px;
  background: rgba(31, 111, 235, 0.08);
  cursor: pointer;
  user-select: none;
  transition: background 0.1s, transform 0.1s;
}
.task-chip::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 2px;
  width: 6px;
  height: 6px;
  border-radius: 1px;
  background: var(--accent);
  opacity: 0.75;
}
@media (hover: hover) { .task-chip:hover {
  background: rgba(31, 111, 235, 0.2);
  transform: scale(1.12);
} }
.block.collapsed .task-chip { display: none; }
#world.zoomed-out .task-chip { display: none; }
#world.zoomed-out .block.kind-day.is-today:not(.collapsed) .task-chip { display: inline-block; }

/* Inside a task the paper changes, so you always know which surface you are
   on without reading anything. */
body[data-canvas='focus'] {
  --paper: #eef1f5;
}
body[data-canvas='focus'] #viewport {
  background:
    radial-gradient(120vw 80vh at 50% 0%, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0) 70%),
    var(--paper);
}
body[data-canvas='focus'] .block { background: rgba(255, 255, 255, 0.72); }
body[data-canvas='focus'] .block.editing { background: #fff; }

#world.entering { animation: enter-canvas 0.22s ease-out; }
@keyframes enter-canvas {
  from { opacity: 0; }
  to { opacity: 1; }
}

#focus-bar {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(620px, 92vw);
  padding: 6px 14px 6px 6px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 3px 18px rgba(20, 22, 26, 0.1);
  backdrop-filter: blur(8px);
  z-index: 55;
  user-select: none;
  animation: drop-in 0.2s ease-out;
}
#focus-bar[hidden] { display: none; }
@keyframes drop-in {
  from { opacity: 0; transform: translate(-50%, -8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

#focus-back {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0;
  flex: none;
}
@media (hover: hover) { #focus-back:hover { background: rgba(20, 22, 26, 0.07); color: var(--ink); } }
#focus-back svg { width: 17px; height: 17px; stroke: currentColor; fill: none; }

#focus-done {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--ink-faint);
  border-radius: 50%;
  background: transparent;
  color: transparent;
  cursor: pointer;
  padding: 0;
  flex: none;
}
@media (hover: hover) { #focus-done:hover { border-color: var(--ink); color: var(--ink-faint); } }
#focus-done svg { width: 14px; height: 14px; stroke: currentColor; }
#focus-done[aria-checked='true'] { background: var(--ink); border-color: var(--ink); color: #fff; }
#focus-done[aria-checked='true'] + #focus-title { color: var(--ink-faint); text-decoration: line-through; text-decoration-thickness: 1px; }

/* Carry to tomorrow sits in the toolbar while you're inside a task. Pressed, it turns the accent. */
#focus-carry[hidden] { display: none; }
#focus-carry[aria-pressed='true'] { color: var(--accent); }

#focus-title {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.focus-hint {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  white-space: nowrap;
  flex: none;
}

/* ------------------------------------------------------------ hud */

#toolbar {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 2px 14px rgba(20, 22, 26, 0.09);
  backdrop-filter: blur(8px);
  z-index: 50;
  user-select: none;
}

.tool {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0;
  font: 600 14px var(--mono);
}
@media (hover: hover) { .tool:hover { background: rgba(20, 22, 26, 0.06); color: var(--ink); } }
.tool.active { background: var(--ink); color: #fff; }
.tool svg { width: 18px; height: 18px; fill: currentColor; stroke: currentColor; }
.tool svg [fill='none'] { fill: none; }
.tool.label { width: auto; padding: 0 10px; font: 500 13px var(--sans, inherit); }
.block.is-report { display: none; }
.tool-sep { width: 1px; height: 20px; background: var(--line); margin: 0 3px; }

/* Above the toolbar, never on it, and clicks go through: a toast sat on the
   Carry button for 4 s after each press and ate the next one (25 Oct). */
#toast {
  position: fixed;
  left: 50%;
  bottom: 76px;
  pointer-events: none;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 8px 15px;
  border-radius: 6px;
  font-size: 13.5px;
  max-width: 62ch;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  z-index: 60;
}
#toast[hidden] { display: none; }

/* ------------------------------------------------------------ report tab */

/* The morning report as a page: it scrolls like a document, sections are cards
   that never split, and the width decides how many sit side by side. */
#report {
  position: fixed;
  inset: 0;
  z-index: 45; /* under the toolbar, so Report toggles straight back */
  background: var(--paper);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
#report[hidden] { display: none; }
body.reading-report #focus-bar { display: none; }

.report-bar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px max(16px, calc((100vw - 1480px) / 2));
  background: rgba(247, 248, 249, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
#report-back {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  flex: none;
}
@media (hover: hover) { #report-back:hover { background: rgba(20, 22, 26, 0.07); color: var(--ink); } }
#report-back svg { width: 17px; height: 17px; stroke: currentColor; fill: none; }
#report-title { font-size: 17px; font-weight: 700; }

#report-body {
  max-width: 1480px;
  margin: 0 auto;
  padding: 20px 16px 24px;
  column-gap: 20px;
}
.report-section {
  break-inside: avoid;
  margin: 0 0 20px;
  padding: 16px 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  white-space: pre-wrap;
}
.report-section > .line:first-child { margin-bottom: 4px; }

/* Feedback: a ruled writing space under the report, no box around it. */
#report-feedback {
  display: block;
  box-sizing: border-box;
  width: calc(100% - 32px);
  max-width: 62ch;
  margin: 8px auto 110px; /* clear the toolbar */
  padding: 10px 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: inherit;
  line-height: 1.6;
  resize: vertical;
  outline: none;
}
#report-feedback::placeholder { color: var(--ink-faint); }
#report-feedback:focus { border-top-color: var(--ink-soft); }

/* A laptop gets two columns, a big monitor three. A phone keeps one. */
@media (min-width: 1000px) { #report-body { columns: 2; padding: 24px 28px 24px; } }
@media (min-width: 1600px) { #report-body { columns: 3; } }
@media (max-width: 640px) {
  .report-bar { padding-top: calc(10px + env(safe-area-inset-top)); }
  #report-body { padding: 12px 12px 16px; }
  #report-feedback { width: calc(100% - 24px); margin-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .report-section { padding: 14px 14px; margin-bottom: 12px; }
}

/* ------------------------------------------------------------ palette */

#palette {
  position: fixed;
  inset: 0;
  background: rgba(20, 22, 26, 0.16);
  z-index: 80;
  display: flex;
  justify-content: center;
  padding-top: 14vh;
}
#palette[hidden] { display: none; }

.palette-box {
  width: min(640px, 92vw);
  background: #fff;
  border-radius: 9px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  height: fit-content;
}

#palette-input {
  width: 100%;
  padding: 15px 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--serif);
  font-size: 18px;
  outline: none;
  color: var(--ink);
}

#palette-results { max-height: 52vh; overflow-y: auto; }

.presult {
  padding: 9px 18px;
  cursor: pointer;
  border-bottom: 1px solid #f0f1f3;
  display: flex;
  gap: 10px;
  align-items: baseline;
}
.presult:last-child { border-bottom: 0; }
.presult.active { background: #eef4ff; }
.presult .p-title { flex: 1; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.presult .p-tag {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.presult mark { background: #ffe9a8; color: inherit; }
.palette-empty { padding: 16px 18px; color: var(--ink-faint); font-size: 14px; }

/* ------------------------------------------------------------ finder (⌘F) */

#finder {
  position: fixed;
  inset: 0;
  background: rgba(20, 22, 26, 0.16);
  z-index: 82;
  display: flex;
  justify-content: center;
  padding-top: 11vh;
}
#finder[hidden] { display: none; }

.finder-box {
  width: min(680px, 94vw);
  background: #fff;
  border-radius: 9px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  height: fit-content;
}

.finder-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 14px;
  border-bottom: 1px solid var(--line);
}
#finder-input {
  flex: 1;
  padding: 15px 18px;
  border: 0;
  font-family: var(--serif);
  font-size: 18px;
  outline: none;
  color: var(--ink);
}
#finder-scope {
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 8px;
  border-radius: 20px;
  background: #eef0f3;
  color: var(--ink-soft);
  white-space: nowrap;
}
#finder-scope[data-scope='reserve'] { background: rgba(124, 92, 255, 0.13); color: #5b3fd6; }

#finder-results { max-height: 56vh; overflow-y: auto; }

.f-group {
  padding: 9px 18px 3px;
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}
.fresult {
  padding: 7px 18px;
  cursor: pointer;
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 15px;
}
.fresult.active { background: #eef4ff; }
.fresult .f-n {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-faint);
  min-width: 15px;
}
.fresult .f-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fresult .f-tag, .fresult .f-when {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-faint);
  white-space: nowrap;
}
.fresult .f-tag { background: #f2f3f5; padding: 1px 5px; border-radius: 3px; }
.fresult.is-done .f-title { color: var(--ink-faint); text-decoration: line-through; }
.finder-foot {
  padding: 8px 18px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--ink-faint);
  font-family: var(--mono);
}
.finder-foot code { background: #f2f3f5; padding: 1px 4px; border-radius: 3px; }

/* ------------------------------------------------------------ /c list */

#client-menu {
  position: fixed;
  z-index: 84;
  min-width: 190px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 34px rgba(20, 22, 26, 0.18);
  overflow: hidden;
  padding: 4px;
}
#client-menu[hidden] { display: none; }
.cm-head {
  font-family: var(--mono);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-faint);
  padding: 5px 9px 4px;
}
.cm-row {
  padding: 6px 9px;
  border-radius: 5px;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}
.cm-row.active { background: #eef4ff; }
.cm-new {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--accent);
  text-transform: uppercase;
}

/* ------------------------------------------------------------ lightbox */

#lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15, 16, 19, 0.9);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
#lightbox[hidden] { display: none; }
#lightbox img { max-width: 94vw; max-height: 94vh; border-radius: 4px; }

/* ------------------------------------------------------------ help */

#help {
  position: fixed;
  inset: 0;
  background: rgba(20, 22, 26, 0.2);
  z-index: 85;
  display: flex;
  align-items: center;
  justify-content: center;
}
#help[hidden] { display: none; }

.help-box {
  background: #fff;
  border-radius: 9px;
  padding: 26px 30px;
  width: min(620px, 92vw);
  max-height: 86vh;
  overflow-y: auto;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.25);
}
.help-box h2 { margin: 0 0 16px; font-size: 19px; font-weight: 700; }
.help-box dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 7px 18px; }
.help-box dt { font-family: var(--mono); font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
.help-box dd { margin: 0; font-size: 14.5px; }
.help-box code {
  font-family: var(--mono);
  font-size: 11.5px;
  background: #f2f3f5;
  padding: 1px 4px;
  border-radius: 3px;
}
.help-foot { margin: 20px 0 0; font-size: 12px; color: var(--ink-faint); font-family: var(--mono); }

/* ------------------------------------------------------------ phone */

/* Fingers, not a cursor. The canvas takes every touch itself (touch.js), so
   the page never scrolls or zooms out from under it. */
@media (pointer: coarse) {
  #viewport {
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }
  .block.editing, .block.editing * {
    -webkit-user-select: text;
    user-select: text;
    -webkit-touch-callout: default;
  }

  /* Handles a thumb can find. */
  .resize-handle { width: 30px; height: 30px; right: -10px; bottom: -10px; }
  .resize-handle::after { right: 10px; bottom: 10px; }
  .resize-handle.left { right: auto; left: -10px; }
  .resize-handle.left::after { right: auto; left: 10px; }
  .link-handle { width: 20px; height: 20px; right: -12px; margin-top: -10px; }
  .task-chip::before { content: ""; position: absolute; inset: -12px; }

  /* Pan is just a finger now, and the key sheet is for keyboards. */
  .tool[data-tool='pan'], .tool[data-action='help'] { display: none; }
  #toolbar {
    bottom: calc(14px + env(safe-area-inset-bottom));
    padding: 5px;
    border-radius: 14px;
  }
  .tool { width: 44px; height: 44px; border-radius: 10px; }
  .tool svg { width: 20px; height: 20px; }
  .tool.label { padding: 0 14px; font-size: 14px; }
  #toast { bottom: calc(80px + env(safe-area-inset-bottom)); max-width: calc(100vw - 32px); }

  #focus-bar { top: calc(10px + env(safe-area-inset-top)); max-width: calc(100vw - 32px); }
  #focus-back { width: 36px; height: 36px; }
  #focus-done { width: 24px; height: 24px; }
  .focus-hint { display: none; }

  #palette, #finder { padding-top: calc(12px + env(safe-area-inset-top)); }
  .palette-box, .finder-box { width: calc(100vw - 32px); }
  .finder-foot { display: none; }
  #client-menu .cm-row { padding: 11px 12px; }
}
