:root {
  --ink: #12262e;
  --orange: #d93d14;
  --orange-dark: #cf3810;
  --cream: #fffdf7;
  --yellow: #ffd12e;
  --note: #ffe9a8;
  --mint: #8ce8cd;
  --pink: #f2a0e0;
  --rust: #b8481f;
  --shadow: rgba(0, 0, 0, 0.32);
  --sans: Archivo, Helvetica, Arial, sans-serif;
  --black: 'Archivo Black', Archivo, Helvetica, sans-serif;
  --mono: 'DM Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* The time rulers down the left and across the top of the pedigree. The HUD
     corners are placed off them, so narrowing the rail on a phone moves the
     buttons in with it. The board has no rulers and zeroes them out. */
  --rail: 68px;
  --rail-top: 26px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--orange);
  font-family: var(--sans);
  color: var(--ink);
  overscroll-behavior: none;
}

#app { height: 100%; }

a { color: var(--ink); }
::selection { background: var(--yellow); color: var(--ink); }

button, input, textarea, select { font: inherit; color: inherit; }

.grid-bg {
  background-color: var(--orange);
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.09) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* ------------------------------------------------------------- primitives */

.paper {
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 18px;
  box-shadow: 8px 10px 0 var(--shadow);
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: 5px 6px 0 rgba(0, 0, 0, 0.3);
  padding: 10px 18px;
  font-family: var(--sans);
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease;
  white-space: nowrap;
}
.pill:hover:not(:disabled) { background: var(--mint); }
.pill:active:not(:disabled) { transform: translate(2px, 3px); box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.3); }
.pill:disabled { opacity: 0.45; cursor: not-allowed; }
.pill:focus-visible { outline: 3px solid var(--pink); outline-offset: 3px; }

.pill--primary { background: var(--yellow); font-family: var(--black); font-weight: 400; }
.pill--primary:hover:not(:disabled) { background: var(--pink); }
.pill--mint { background: var(--mint); }
.pill--mint:hover:not(:disabled) { background: var(--yellow); }
.pill--danger { background: var(--pink); }
.pill--danger:hover:not(:disabled) { background: var(--yellow); }
.pill--small { padding: 7px 16px; font-size: 13px; box-shadow: 4px 5px 0 rgba(0, 0, 0, 0.28); }
.pill--ghost { background: transparent; box-shadow: none; border-style: dashed; }

.icon-btn {
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 999px;
  border: 3px solid var(--ink);
  background: var(--cream);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--black);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
}
.icon-btn:hover { background: var(--pink); }

.kicker {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--rust);
}
.mono { font-family: var(--mono); }
.display { font-family: var(--black); letter-spacing: -0.02em; line-height: 1.05; }
.muted { opacity: 0.62; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.65;
}
.field input, .field textarea, .field select {
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 12px;
  padding: 10px 13px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 15px;
  width: 100%;
}
.field textarea { resize: vertical; min-height: 76px; line-height: 1.45; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: 3px solid var(--pink);
  outline-offset: 2px;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.form-error {
  background: var(--pink);
  border: 3px solid var(--ink);
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 14px;
}

/* ------------------------------------------------------------------ toasts */

.toasts {
  position: fixed;
  right: 22px;
  bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 90;
  pointer-events: none;
}
.toast {
  background: var(--ink);
  color: var(--mint);
  border-radius: 14px;
  box-shadow: 5px 6px 0 rgba(0, 0, 0, 0.3);
  padding: 12px 18px;
  font-weight: 700;
  font-size: 14px;
  max-width: 380px;
  animation: pop 0.16s ease-out;
}
.toast--bad { background: var(--pink); color: var(--ink); border: 3px solid var(--ink); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

/* ------------------------------------------------------------------- modal */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(18, 38, 46, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 80;
  overflow: auto;
}
.modal {
  width: min(560px, 100%);
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 22px;
  box-shadow: 10px 12px 0 rgba(0, 0, 0, 0.35);
  padding: 26px 30px 30px;
  transform: rotate(-0.5deg);
  margin: auto;
}
.modal--wide { width: min(720px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.modal-body { margin-top: 20px; display: flex; flex-direction: column; gap: 16px; }
.modal-actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }

.dropzone {
  border: 3px dashed var(--ink);
  border-radius: 16px;
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  background: transparent;
  width: 100%;
}
.dropzone:hover, .dropzone.is-over { background: var(--note); }

/* -------------------------------------------------------------------- auth */

.auth {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}
.auth-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 420px);
  gap: 40px;
  align-items: center;
  max-width: 1000px;
  width: 100%;
}
.auth-pitch { color: var(--cream); }
.auth-pitch h1 {
  font-family: var(--black);
  font-size: clamp(44px, 7vw, 76px);
  line-height: 0.94;
  letter-spacing: -0.03em;
  margin: 0;
}
.auth-pitch p { font-weight: 600; font-size: 18px; line-height: 1.5; max-width: 44ch; }
.auth-points { list-style: none; padding: 0; margin: 26px 0 0; display: flex; flex-direction: column; gap: 10px; }
.auth-points li {
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-weight: 600;
  font-size: 16px;
}
.auth-points li::before {
  content: '▪';
  color: var(--yellow);
  font-size: 20px;
}
.auth-card { padding: 30px 32px 34px; transform: rotate(-1deg); }
.auth-card form { display: flex; flex-direction: column; gap: 16px; margin-top: 20px; }
.auth-switch { margin-top: 18px; font-size: 14px; font-weight: 600; }
.auth-switch button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-weight: 800;
  text-decoration: underline;
  cursor: pointer;
}
.logo-badge {
  display: inline-block;
  background: var(--yellow);
  border: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: 6px 7px 0 rgba(0, 0, 0, 0.35);
  padding: 9px 18px 11px;
  transform: rotate(-2deg);
}
.logo-badge .logo-title {
  font-family: var(--black);
  font-size: 24px;
  line-height: 1;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.logo-badge .logo-sub {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 4px;
  opacity: 0.7;
}

/* ------------------------------------------------------------- tree picker */

.trees { min-height: 100%; padding: 34px 32px 80px; }
.trees-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  max-width: 1100px;
  margin: 0 auto;
}
.trees-list {
  max-width: 1100px;
  margin: 32px auto 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}
.tree-card { padding: 22px 24px 24px; display: flex; flex-direction: column; gap: 12px; cursor: pointer; }
.tree-card:nth-child(3n+1) { transform: rotate(-0.8deg); }
.tree-card:nth-child(3n+2) { transform: rotate(0.7deg); }
.tree-card:hover { background: var(--yellow); }
.tree-card h3 { font-family: var(--black); font-size: 22px; margin: 0; line-height: 1.12; word-break: break-word; }
.tree-card .tree-meta { font-family: var(--mono); font-size: 12px; opacity: 0.6; }
.tree-card .tree-actions { display: flex; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.empty-state {
  max-width: 1100px;
  margin: 32px auto 0;
  padding: 34px 32px 36px;
  transform: rotate(-0.5deg);
}

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

.canvas-view {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  --surface: var(--orange);
  --surface-edge: var(--orange-dark);
}
/* The canvas is panned by dragging, so the scrollbars are only clutter over
   the artwork — scrolling itself stays untouched. */
.scroller {
  position: absolute;
  inset: 0;
  overflow: auto;
  cursor: grab;
  user-select: none;
  /* Touches are driven from `pinch.js` — panning included. Leaving the browser
     its own panning let it commit to a scroll on the first finger of a pinch,
     after which it ignores preventDefault and the two fight over the offsets. */
  touch-action: none;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.scroller::-webkit-scrollbar { width: 0; height: 0; display: none; }
.scroller.is-panning { cursor: grabbing; }
/* Text is left to the browser: caret, selection and the on-screen keyboard. */
.scroller [contenteditable] { touch-action: auto; }
/* Holds the scaled size so the scroll extent matches what is actually drawn. */
.canvas-sizer { position: relative; }
.canvas-sizer > * { position: absolute; left: 0; top: 0; }

.canvas {
  position: relative;
  transform-origin: 0 0;
  background-color: var(--surface);
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.09) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: 34px 34px;
}

/* Both rulers are pinned to the window; the chart scrolls underneath them. */
.ruler-top {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: var(--rail-top);
  z-index: 15;
  pointer-events: none;
  background-color: var(--surface-edge);
  border-bottom: 1px solid rgba(0, 0, 0, 0.25);
  background-image: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.35) 0 1px, transparent 1px 40px);
}
.ruler-left {
  position: absolute;
  left: 0; top: var(--rail-top); bottom: 0;
  width: var(--rail);
  z-index: 15;
  pointer-events: none;
  overflow: hidden;
  background: var(--surface-edge);
  border-right: 1px solid rgba(0, 0, 0, 0.25);
}
.ruler-track {
  position: absolute;
  left: 0; right: 0;
  top: calc(-1 * var(--rail-top));
  height: 100%;
  will-change: transform;
}
.axis-tick {
  position: absolute;
  left: 0; right: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.4);
  padding: var(--axis-pad, 4px 0 0 6px);
}
.axis-tick .axis-year {
  font-family: var(--mono);
  font-size: var(--axis-year, 12px);
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
}
.axis-tick .axis-gen {
  font-family: var(--mono);
  font-size: var(--axis-gen, 9px);
  letter-spacing: var(--axis-gen-tracking, 0.1em);
  white-space: nowrap;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 2px;
}

.edge { position: absolute; background: var(--ink); }

/* A connector long enough to outrun the screen can be travelled. The line is
   only 4px, so the hover area is widened with a transparent pseudo-element —
   but the line itself stays inert; the arrow it raises does the work. */
.edge--nav::before { content: ''; position: absolute; inset: -10px; }
/* Lit while its arrow is up, not on :hover — the arrow sits on the line and
   would otherwise steal the hover back and forth, blinking the highlight. */
.edge--nav.is-travelling {
  background-color: var(--mint);
  background-image: none;
  outline: 2px solid var(--ink);
}

.edge-arrow {
  position: absolute;
  z-index: 26;
  width: 34px;
  height: 34px;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--mint);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 3px 4px 0 rgba(0, 0, 0, 0.3);
  transform: translate(-50%, -50%);
}
.edge-arrow:hover { background: var(--yellow); }
.edge-arrow:focus-visible { outline: 3px solid var(--pink); outline-offset: 3px; }
.edge-arrow-glyph {
  display: flex;
  width: 18px;
  height: 18px;
  transform: rotate(var(--arrow-angle, 0deg));
}
.edge-arrow-glyph svg { width: 100%; height: 100%; display: block; }
/* A partnership that ended is drawn broken rather than solid. */
.edge--ended {
  background: none;
  background-image: repeating-linear-gradient(90deg, var(--ink) 0 7px, transparent 7px 14px);
}

.node {
  position: absolute;
  width: 240px;
  height: 96px;
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 15px;
  box-shadow: 5px 6px 0 var(--shadow);
  padding: 13px 18px;
  cursor: pointer;
  transition: box-shadow 0.12s ease;
}
.node:hover { box-shadow: 7px 9px 0 var(--shadow); }
.node.is-you { background: var(--yellow); }
.node.is-gen1 { background: var(--mint); }
.node.is-draft { border-style: dashed; }
.node.is-selected { outline: 4px solid var(--pink); outline-offset: 3px; z-index: 6; }
.node-role { font-family: var(--mono); font-size: 9px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--rust); }
.node-name {
  font-family: var(--black);
  font-size: 20px;
  line-height: 1.1;
  margin-top: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.node-years {
  font-family: var(--mono);
  font-size: 12px;
  margin-top: 6px;
  opacity: 0.65;
  display: flex;
  align-items: baseline;
  gap: 5px;
}

/* Anyone no longer living gets a faint wash over whatever colour the card has,
   so it reads as "past" without repainting the role colours. */
.node.is-gone { background-image: linear-gradient(rgba(18, 38, 46, 0.09), rgba(18, 38, 46, 0.09)); }
.node.is-gone .node-name { opacity: 0.82; }

.life-mark { flex: none; }
.life-mark--dead { font-size: 13px; line-height: 1; opacity: 0.9; }
.life-mark--living {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--mint);
  border: 2px solid var(--ink);
  align-self: center;
  margin-bottom: 1px;
}

.hero-tags span.tag-living { background: var(--mint); border-color: var(--ink); }

/* Zoomed out far enough that the small print would be unreadable: drop it and
   let the name fill the card, drawn larger so it still reads on screen. */
.node.is-compact { display: flex; align-items: center; padding: 10px 16px; }
.node.is-compact .node-role,
.node.is-compact .node-years { display: none; }
.node.is-compact .node-name {
  margin-top: 0;
  white-space: normal;
  line-height: 1.06;
  max-height: 100%;
  overflow: hidden;
}

.node-toggle {
  position: absolute;
  left: 50%;
  top: -18px;
  transform: translateX(-50%);
  min-width: 34px;
  height: 30px;
  padding: 0 9px;
  background: var(--ink);
  color: var(--yellow);
  border: 3px solid var(--ink);
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--black);
  font-size: 14px;
  cursor: pointer;
}
.node-toggle:hover { background: var(--yellow); color: var(--ink); }
.node-toggle--down { top: auto; bottom: -18px; background: var(--ink); color: var(--mint); }
.node-toggle--down:hover { background: var(--mint); color: var(--ink); }

/* Brothers and sisters fold in from the side, so their tab sits on the edge. */
.node-toggle--side {
  left: auto;
  top: auto;
  right: -17px;
  bottom: 26px;
  transform: translateY(50%);
  background: var(--ink);
  color: var(--pink);
  transform-origin: 100% 50%;
}
.node-toggle--side:hover { background: var(--pink); color: var(--ink); }

.node-addanc {
  position: absolute;
  left: 50%;
  top: -18px;
  transform: translateX(-50%);
  height: 30px;
  padding: 0 12px;
  background: rgba(217, 61, 20, 0.92);
  color: var(--cream);
  border: 3px dashed var(--cream);
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
}
.node-addanc:hover { background: var(--ink); border-color: var(--yellow); }

.node-del {
  position: absolute;
  right: -13px;
  top: -13px;
  width: 26px;
  height: 26px;
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--black);
  font-size: 11px;
  cursor: pointer;
}
.node-del:hover { background: var(--pink); }

/* pinned items — shared by the pinboard */
.item { position: absolute; cursor: move; }
/* The controls belong to the pin under the pointer, not to the whole board —
   a wall of crosses is the first thing you see otherwise. */
.item-del, .pin-rotate {
  opacity: 0;
  transition: opacity 0.12s;
}
.pin:hover .item-del,
.pin:hover .pin-rotate,
.item-del:focus-visible,
.pin-rotate:focus-visible { opacity: 1; }

.item-del {
  position: absolute;
  right: -14px;
  top: -14px;
  width: 28px;
  height: 28px;
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--black);
  font-size: 12px;
  cursor: pointer;
  z-index: 3;
}
.item-del:hover { background: var(--pink); }

/* Sits opposite the cross, so nothing has to share a corner. */
.pin-rotate {
  position: absolute;
  left: -14px;
  top: -14px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 3px solid var(--ink);
  background: var(--cream);
  cursor: grab;
  padding: 0;
  z-index: 3;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2312262e' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 12a8 8 0 1 1-2.6-5.9'/%3E%3Cpath d='M20 4v4.4h-4.4'/%3E%3C/svg%3E");
  background-size: 15px 15px;
  background-repeat: no-repeat;
  background-position: center;
}
.pin-rotate:hover { background-color: var(--mint); }
.pin-rotate:active { cursor: grabbing; }
.polaroid {
  width: 216px;
  background: var(--cream);
  border-radius: 4px;
  box-shadow: 8px 10px 18px rgba(0, 0, 0, 0.22);
  padding: 12px 12px 34px;
}
.polaroid .frame {
  height: 170px;
  background-image: repeating-linear-gradient(135deg, #e6e1d6 0 8px, #f2eee4 8px 16px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.polaroid .frame span {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8b8578;
  text-align: center;
  padding: 0 10px;
}
.polaroid .frame img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* A pinned video: the still, with the one badge that says it will play. */
.frame--video { position: relative; cursor: pointer; }
.play-badge {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--cream);
  color: var(--ink);
  box-shadow: 3px 4px 0 rgba(0, 0, 0, 0.3);
  pointer-events: none;
}
.play-badge svg { width: 22px; height: 22px; display: block; }
.frame--video:hover .play-badge { background: var(--yellow); }

/* The player fills the dialog and keeps a video's shape while it does. */
.video-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 3px solid var(--ink);
  border-radius: 12px;
  overflow: hidden;
  background: var(--ink);
}
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* A sheet of several pictures is composed to its own shape, so its frame takes
   the shape rather than cropping to a photo's. It gets a wider card with it —
   at 216 px the faces in a six-picture collage are the size of a fingernail. */
.pin--collage .polaroid { width: 320px; }
.pin--collage .polaroid .frame { height: auto; background-image: none; }
.pin--collage .polaroid .frame img { height: auto; object-fit: contain; }

/* A pinned file is a tile, not a card: the glyph says what the document is,
   and everything you can do with it lives behind opening it. */
.file-card {
  position: relative;
  width: 132px;
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 14px;
  box-shadow: 5px 6px 0 rgba(0, 0, 0, 0.3);
  padding: 12px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
  text-align: center;
}
.file-card .file-glyph {
  width: 56px;
  height: 56px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: var(--yellow);
  color: var(--ink);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.12s ease, background 0.12s ease;
}
.file-card .file-glyph { text-decoration: none; }
.file-card .file-glyph:hover { background: var(--mint); transform: scale(1.05); }
.file-card .file-glyph:focus-visible { outline: 3px solid var(--pink); outline-offset: 3px; }
.file-glyph-svg { display: block; width: 32px; height: 32px; }
.file-glyph-svg svg { width: 100%; height: 100%; display: block; }
.file-glyph-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file-card .file-name {
  font-weight: 800;
  font-size: 13px;
  line-height: 1.2;
  word-break: break-word;
  cursor: text;
  width: 100%;
}
.file-card .file-meta { font-family: var(--mono); font-size: 10px; opacity: 0.55; }
/* Where the link really goes, said on the card itself — the title above it is
   whatever the person who pinned it felt like typing. */
.file-card .link-host {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--rust);
  opacity: 0.75;
}
.pin--link .file-glyph { background: var(--mint); }
.pin--link .file-glyph:hover { background: var(--yellow); }
/* Sits on the tile's corner like the note's colour dot and the pin's handles. */
.file-icon-swap {
  position: absolute;
  left: -9px;
  bottom: -9px;
  width: 24px;
  height: 24px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--mint);
  cursor: pointer;
  padding: 0;
}
.file-icon-swap:hover { background: var(--yellow); }

/* The document itself, read without saving it first. */
.file-frame {
  width: 100%;
  height: min(62vh, 620px);
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: var(--cream);
  display: block;
}
/* Written in the dialog, where there is room for it. */
.file-note {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  color: #5d564b;
  margin-top: 10px;
  cursor: text;
  word-break: break-word;
}
.file-facts {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font-family: var(--mono);
  font-size: 11px;
  opacity: 0.55;
  margin-top: 10px;
  word-break: break-all;
}

/* ------------------------------------------------------------- icon picker */

.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.icon-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 12px 8px 10px;
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 12px;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
}
.icon-choice:hover { background: var(--yellow); }
.icon-choice.is-current { background: var(--mint); }
.icon-choice-glyph { display: block; width: 30px; height: 30px; }
.icon-choice-glyph svg { width: 100%; height: 100%; display: block; }
.icon-choice-label { font-family: var(--mono); font-size: 10px; opacity: 0.6; }
.sticky {
  width: 210px;
  background: var(--note);
  border: 2px solid rgba(0, 0, 0, 0.22);
  box-shadow: 6px 8px 14px rgba(0, 0, 0, 0.18);
  padding: 20px 18px 24px;
  font-weight: 700;
  font-size: 17px;
  line-height: 1.35;
  cursor: text;
}
[contenteditable]:focus { outline: 2px dashed rgba(0, 0, 0, 0.4); outline-offset: 3px; }

/* Placed in screen pixels over the canvas, so zoom never resizes it. */
.context-menu {
  position: absolute;
  width: 236px;
  background: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: 7px 9px 0 var(--shadow);
  padding: 8px;
  z-index: 28;
}
.context-menu .menu-label,
.hud-menu-panel .menu-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mint);
  padding: 6px 10px 8px;
}
.context-menu button {
  width: 100%;
  background: var(--cream);
  border: none;
  border-radius: 10px;
  padding: 9px 12px;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  text-align: left;
}
.context-menu button:hover { background: var(--yellow); }
/* It carries the same glyphs as the header's own list, so the two read alike. */
.context-menu .menu-item-glyph { color: var(--rust); }

/* canvas chrome */
/* The bars stretch wider than their buttons, so only the buttons take clicks —
   otherwise an invisible strip would swallow drags on the canvas beneath. */
.hud { position: absolute; z-index: 25; display: flex; align-items: center; gap: 12px; pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud-tl { left: calc(var(--rail) + 16px); top: 40px; gap: 14px; }
/* Anchored right and never wrapping: a hovered label unrolls to its full
   width, and the row has to be free to grow leftwards over the canvas instead
   of folding onto a second line under itself. */
.hud-tr { right: 24px; top: 40px; flex-wrap: nowrap; justify-content: flex-end; }
.hud-bl { left: calc(var(--rail) + 16px); bottom: 24px; }
.stat-badge {
  background: var(--ink);
  border-radius: 14px;
  box-shadow: 5px 6px 0 rgba(0, 0, 0, 0.3);
  padding: 8px 16px 10px;
  transform: rotate(-1.5deg);
  color: var(--mint);
}
.stat-badge .stat-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.65;
}
.stat-badge .stat-value { font-family: var(--black); font-size: 17px; line-height: 1.1; margin-top: 2px; }
.zoom-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: 5px 6px 0 rgba(0, 0, 0, 0.3);
  padding: 6px 8px;
}
.zoom-bar button {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 999px;
  background: var(--cream);
  font-family: var(--black);
  font-size: 18px;
  cursor: pointer;
}
.zoom-bar button:hover { background: var(--yellow); }
.zoom-bar .zoom-label { font-family: var(--mono); font-size: 12px; color: var(--mint); min-width: 44px; text-align: center; }

.selection {
  position: absolute;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) rotate(-1deg);
  width: min(470px, calc(100vw - 48px));
  padding: 20px 22px 22px;
  z-index: 30;
}
.selection .sel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.selection .sel-name { font-family: var(--black); font-size: 26px; line-height: 1.1; margin-top: 5px; }
.selection .sel-meta { font-family: var(--mono); font-size: 13px; margin-top: 6px; opacity: 0.65; }
.selection .sel-note { font-weight: 600; font-size: 15px; line-height: 1.45; margin-top: 14px; }
.selection .sel-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

/* ----------------------------------------------------------------- profile */

.profile { position: absolute; inset: 0; overflow: auto; z-index: 40; }
.profile-inner { max-width: 1080px; margin: 0 auto; padding: 30px 32px 90px; }
.profile-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.profile-top .profile-kicker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.8);
}
.profile-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 26px;
  margin-top: 26px;
  align-items: start;
}
.hero-card {
  background: var(--yellow);
  border: 3px solid var(--ink);
  border-radius: 20px;
  box-shadow: 8px 10px 0 var(--shadow);
  padding: 26px 30px 30px;
  transform: rotate(-0.8deg);
}
.hero-card .hero-name { font-family: var(--black); font-size: clamp(32px, 4.4vw, 50px); line-height: 0.98; margin-top: 8px; letter-spacing: -0.02em; word-break: break-word; }
.hero-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.hero-tags span {
  background: var(--ink);
  color: var(--yellow);
  border-radius: 999px;
  padding: 6px 14px;
  font-family: var(--mono);
  font-size: 12px;
}
.hero-tags span.tag-mint { color: var(--mint); }
.hero-tags span.tag-plain { background: var(--cream); color: var(--ink); border: 2px solid var(--ink); }
.hero-note { font-weight: 700; font-size: 19px; line-height: 1.4; margin-top: 22px; max-width: 46ch; cursor: text; }
.portrait {
  background: var(--cream);
  border-radius: 4px;
  box-shadow: 8px 10px 18px rgba(0, 0, 0, 0.22);
  padding: 14px 14px 44px;
  transform: rotate(2.2deg);
}
.portrait .frame {
  width: 100%;
  height: 250px;
  padding: 0;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8b8578;
  cursor: pointer;
  overflow: hidden;
}
.portrait .frame--empty {
  background-image: repeating-linear-gradient(135deg, #e6e1d6 0 8px, #f2eee4 8px 16px);
  line-height: 1.9;
}
.portrait .frame--empty b { color: var(--rust); }
.portrait .frame--empty:hover { background-image: repeating-linear-gradient(135deg, #ffe9a8 0 8px, #fff6d8 8px 16px); }
.portrait .frame:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }
.portrait .frame--filled { background: #e6e1d6; }
.portrait .frame--filled img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Only hinted at until the picture is hovered — the frame is the subject. */
.portrait .frame--filled:hover img { opacity: 0.82; }
.portrait .cap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  margin-top: 12px;
  color: #6b6459;
}
.portrait .cap-drop {
  flex: none;
  width: 22px;
  height: 22px;
  border: 2px solid rgba(18, 38, 46, 0.25);
  border-radius: 999px;
  background: none;
  color: #6b6459;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  padding: 0;
}
.portrait .cap-drop:hover { background: var(--pink); border-color: var(--ink); color: var(--ink); }

.profile-cols {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 26px;
  margin-top: 28px;
  align-items: start;
}
.panel {
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 20px;
  box-shadow: 8px 10px 0 var(--shadow);
  padding: 24px 28px 28px;
}
.panel h2 { font-family: var(--black); font-size: 22px; margin: 0; font-weight: 400; }
.panel--mint { background: var(--mint); transform: rotate(1deg); padding: 22px 26px 26px; }
.panel--mint .group-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-top: 18px;
  color: #1c6b56;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; align-items: center; }
.chip {
  background: var(--cream);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.chip:hover { background: var(--yellow); }
.chip--add { background: transparent; border-style: dashed; font-family: var(--mono); font-size: 12px; }
.chip--empty { cursor: default; opacity: 0.55; border-style: dashed; }
.chip--ended { border-style: dashed; }
.chip-note {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 10px;
  letter-spacing: 0.06em;
  opacity: 0.55;
  margin-left: 7px;
}
.chip--empty:hover { background: transparent; }

.event-row {
  display: flex;
  gap: 18px;
  align-items: baseline;
  padding: 12px 0;
  border-top: 2px solid rgba(18, 38, 46, 0.12);
}
.event-row .event-year { font-family: var(--black); font-size: 18px; color: var(--rust); min-width: 62px; }
.event-row .event-label { font-weight: 600; font-size: 16px; line-height: 1.35; flex: 1; }
.event-row .event-del { border: none; background: none; cursor: pointer; font-size: 15px; opacity: 0.35; padding: 0 4px; }
.event-row .event-del:hover { opacity: 1; }

.todo-note {
  background: var(--note);
  border: 2px solid rgba(0, 0, 0, 0.22);
  box-shadow: 6px 8px 14px rgba(0, 0, 0, 0.18);
  padding: 22px 22px 26px;
  transform: rotate(-1.6deg);
}
.todo-note .todo-text { font-weight: 700; font-size: 17px; line-height: 1.4; cursor: text; }
.todo-note .todo-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 14px;
  opacity: 0.5;
}

.files-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.files-head h2 { font-family: var(--black); font-size: 24px; color: var(--cream); margin: 0; font-weight: 400; }
.files-head .files-count { font-family: var(--mono); font-size: 11px; color: rgba(255, 255, 255, 0.7); }

.gedcom-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-top: 2px solid rgba(18, 38, 46, 0.12);
  flex-wrap: wrap;
}
.gedcom-row .ged-name { font-weight: 800; font-size: 15px; word-break: break-all; }
.gedcom-row .ged-meta { font-family: var(--mono); font-size: 11px; opacity: 0.6; margin-top: 3px; }

.warn-list {
  margin: 0;
  padding-left: 18px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  max-height: 160px;
  overflow: auto;
}

.spinner-screen {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cream);
  font-family: var(--black);
  font-size: 22px;
}

@media (max-width: 900px) {
  .auth-grid { grid-template-columns: 1fr; }
  .profile-hero, .profile-cols { grid-template-columns: 1fr; }
  .profile-inner { padding: 20px 18px 70px; }
  .field-row { grid-template-columns: 1fr; }
  .modal { padding: 22px 20px 24px; transform: none; }

  /* A phone has no room for a row of header buttons over the chart: they fold
     into the hamburger (as `.is-compact-only` entries), leaving one menu
     button that sits beside the crest on the top row. */
  /* Scoped to `.hud` so these beat the base `.hud-icon` rule further down. */
  .hud .hud-icon--roomy,
  .hud .hud-menu--roomy,
  .hud .self-badge { display: none; }

  /* The time rail gives up most of its width — at 68px it was eating a fifth of
     a phone screen that the pedigree needs. */
  .canvas-view { --rail: 36px; --rail-top: 18px; }
  .board-view { --rail: 4px; --rail-top: 0px; }
  .axis-tick {
    --axis-year: 10px;
    --axis-gen: 7px;
    --axis-gen-tracking: 0.02em;
    --axis-pad: 3px 0 0 3px;
  }

  .hud-tl { top: 34px; gap: 10px; }
  .hud-tr { right: 14px; top: 34px; left: auto; gap: 8px; }
  .hud-bl { bottom: 14px; }
  .hud .pill { padding: 8px 13px; font-size: 13px; box-shadow: 4px 5px 0 rgba(0, 0, 0, 0.3); }
  .selection {
    width: calc(100vw - var(--rail) - 30px);
    bottom: 16px;
    left: calc(var(--rail) + 16px);
    transform: none;
  }
  .trees { padding: 20px 16px 60px; }
  .logo-badge .logo-title { font-size: 19px; max-width: 46vw; }

  /* Zoom and „back“ belong on one line — stacked, they climbed up the board. */
  .hud-bl { flex-wrap: nowrap; gap: 8px; max-width: calc(100vw - var(--rail) - 30px); }
  .hud-bl .zoom-bar { gap: 6px; padding: 4px 6px; }
  .hud-bl .zoom-bar button { width: 30px; height: 30px; font-size: 16px; }
  .hud-bl .zoom-bar .zoom-label { min-width: 34px; font-size: 11px; }
  .hud-bl .pill { padding: 7px 11px; font-size: 12px; white-space: nowrap; }
}

/* ------------------------------------------------------------ person picker */

.picker-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  width: 100%;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  text-align: left;
}
.picker-row:hover { background: var(--yellow); }
.picker-row.is-current { background: var(--mint); }
.picker-name { font-weight: 800; font-size: 15px; }
.picker-meta { font-family: var(--mono); font-size: 11px; opacity: 0.6; white-space: nowrap; }

.self-badge {
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 14px;
  box-shadow: 5px 6px 0 rgba(0, 0, 0, 0.3);
  padding: 8px 15px 10px;
  transform: rotate(-1deg);
  cursor: pointer;
  text-align: left;
  font: inherit;
}
.self-badge:hover { background: var(--mint); }
.self-badge .self-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--rust);
}
.self-badge .self-name {
  font-family: var(--black);
  font-size: 15px;
  line-height: 1.1;
  margin-top: 3px;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ------------------------------------------------------------- header icons */

.hud-icon {
  display: inline-flex;
  align-items: center;
  height: 46px;
  padding: 0 12px;
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: 5px 6px 0 rgba(0, 0, 0, 0.3);
  cursor: pointer;
  overflow: hidden;
  color: var(--ink);
  transition: background 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease;
}
.hud-icon:hover { background: var(--mint); }
.hud-icon:active { transform: translate(2px, 3px); box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.3); }
.hud-icon:focus-visible { outline: 3px solid var(--pink); outline-offset: 3px; }
.hud-icon--mint { background: var(--mint); }
.hud-icon--mint:hover { background: var(--yellow); }
.hud-icon--primary { background: var(--yellow); }
.hud-icon--primary:hover { background: var(--pink); }
/* A tool stays in the hand until it is put down, so its button stays pressed. */
.hud-icon--on { background: var(--ink); color: var(--mint); }
.hud-icon--on:hover { background: var(--rust); color: var(--cream); }

.hud-icon-glyph { display: flex; width: 20px; height: 20px; flex: none; }
.hud-icon-glyph svg { width: 100%; height: 100%; display: block; }

/* The label unrolls on hover; collapsed it takes no width at all. */
.hud-icon-label {
  max-width: 0;
  margin-left: 0;
  opacity: 0;
  white-space: nowrap;
  font-family: var(--sans);
  font-weight: 800;
  font-size: 15px;
  transition: max-width 0.18s ease, margin-left 0.18s ease, opacity 0.12s ease;
}
.hud-icon:hover .hud-icon-label,
.hud-icon:focus-visible .hud-icon-label {
  max-width: 220px;
  margin-left: 9px;
  opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
  .hud-icon-label,
  .brand .logo-badge { transition: none; }
}

.hud-menu { position: relative; display: inline-flex; }
.hud-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: 244px;
  background: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: 7px 9px 0 var(--shadow);
  padding: 8px;
  z-index: 30;
}
.hud-menu-panel button {
  width: 100%;
  background: var(--cream);
  border: none;
  border-radius: 10px;
  padding: 9px 12px;
  font-family: var(--sans);
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
  text-align: left;
}
.hud-menu-panel button:last-child { margin-bottom: 0; }
.hud-menu-panel button:hover { background: var(--yellow); }
.hud-menu-panel button.is-danger:hover { background: var(--pink); }
.menu-item-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.menu-item-glyph {
  display: flex;
  width: 17px;
  height: 17px;
  flex: none;
  color: var(--rust);
}
.menu-item-glyph svg { width: 100%; height: 100%; display: block; }
.menu-item-hint {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 11px;
  opacity: 0.45;
  white-space: nowrap;
}

/* Duplicates of the header buttons — only earned once those have folded away.
   Where they do show they lead the panel as one tinted block, so the everyday
   tools stay a tool row and do not read as more settings. */
@media (min-width: 901px) {
  .hud-menu--phone-only { display: none; }
  .hud-menu-panel button.is-compact-only { display: none; }
}
@media (max-width: 900px) {
  /* The tool rows carry a glyph as well as a hint, so the panel earns some
     extra width rather than wrapping their labels onto a second line. */
  .hud-menu-panel { width: min(296px, calc(100vw - 28px)); }
  .hud-menu-panel button.is-compact-only { background: var(--mint); }
  .hud-menu-panel button.is-compact-only:hover { background: var(--yellow); }
  /* A wider strip of the panel's own dark shows through between the blocks. */
  .hud-menu-panel button.is-compact-only + button:not(.is-compact-only) {
    margin-top: 12px;
  }
}

/* ------------------------------------------------------------------ account */

.account-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.account-section { border-top: 3px solid rgba(18, 38, 46, 0.12); padding-top: 18px; }
.account-section form { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
.form-error--ok { background: var(--mint); }


/* ------------------------------------------------------------ tree emblem */

/* The crest and the name badge lean together as one sticker, so the tilt lives
   on the pair rather than on the badge alone. Only the crest is on show; the
   name unrolls from behind it on hover, the same way the header buttons do. */
.brand { display: flex; align-items: center; transform: rotate(-2deg); }
.brand .logo-badge {
  transform: none;
  overflow: hidden;
  white-space: nowrap;
  /* Padding and border have to collapse too, or the badge keeps a 58px stump
     behind the crest and pushes everything after it along. */
  max-width: 0;
  margin-left: 0;
  padding: 0;
  border-width: 0;
  opacity: 0;
  transition: max-width 0.2s ease, margin-left 0.2s ease, padding 0.2s ease,
    border-width 0.2s ease, opacity 0.14s ease;
}
.brand:hover .logo-badge,
.brand:focus-within .logo-badge {
  max-width: 440px;
  margin-left: -20px;
  padding: 9px 18px 11px 34px;
  border-width: 3px;
  opacity: 1;
}

.tree-emblem {
  position: relative;
  z-index: 2;
  flex: none;
  width: var(--emblem-size, 80px);
  height: var(--emblem-size, 80px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  filter: drop-shadow(4px 5px 0 rgba(0, 0, 0, 0.32));
  transition: transform 0.12s ease;
}
.tree-emblem img { width: 100%; height: 100%; object-fit: contain; display: block; }
button.tree-emblem:hover { transform: scale(1.07); }
button.tree-emblem:focus-visible { outline: 3px solid var(--pink); outline-offset: 3px; border-radius: 10px; }

.tree-emblem.is-empty {
  border: 3px dashed rgba(255, 253, 247, 0.75);
  border-radius: 12px;
  color: rgba(255, 253, 247, 0.8);
  filter: none;
  background: rgba(18, 38, 46, 0.18);
}
button.tree-emblem.is-empty:hover { background: var(--ink); color: var(--yellow); transform: none; }
.tree-emblem-empty { display: block; width: 55%; height: 55%; }
.tree-emblem-empty svg { width: 100%; height: 100%; display: block; }

.tree-card-head { display: flex; align-items: center; gap: 14px; }
.tree-card-head h3 { margin-top: 2px; }
.tree-card .tree-emblem.is-empty { border-color: rgba(18, 38, 46, 0.3); color: rgba(18, 38, 46, 0.45); background: none; }

.icon-preview {
  align-self: flex-start;
  width: 132px;
  height: 132px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px dashed var(--ink);
  border-radius: 16px;
  background: repeating-conic-gradient(rgba(18, 38, 46, 0.07) 0% 25%, transparent 0% 50%) 50% / 18px 18px;
  color: rgba(18, 38, 46, 0.4);
}
.icon-preview img { max-width: 84%; max-height: 84%; object-fit: contain; }


@media (max-width: 900px) {
  .brand { --emblem-size: 56px; }
  .brand:hover .logo-badge,
  .brand:focus-within .logo-badge { margin-left: -16px; padding: 8px 14px 10px 26px; }
}

/* ----------------------------------------------------------------- marker */

/* Ink is not a card: it takes no clicks, so a stroke never swallows the drag
   that pans the board underneath it. */
.pin--stroke { pointer-events: none; }
/* A stroke sent to the back carries a negative z-index. The board canvas is a
   stacking context of its own (it is scaled), so that puts the ink under every
   pin while still leaving it on top of the board's own paper. */
.stroke-ink svg { display: block; overflow: visible; }
/* The stroke being laid down right now, above the board and equally inert. */
.ink-layer { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 5; }
.scroller.is-drawing { cursor: crosshair; }
.scroller.is-drawing .pin { cursor: crosshair; }

.marker-bar {
  position: absolute;
  left: 50%;
  /* Above the zoom row rather than beside it: centred on a narrow window the
     bar would otherwise grow straight into the „zpět“ pill. */
  bottom: 82px;
  transform: translateX(-50%);
  z-index: 26;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: 6px 7px 0 rgba(0, 0, 0, 0.3);
  padding: 8px 14px;
}
.marker-tools, .marker-history, .marker-inks, .marker-nibs, .marker-layers {
  display: flex;
  align-items: center;
  gap: 8px;
}
/* The rule between groups is drawn by the group that follows one. */
.marker-history, .marker-inks, .marker-nibs, .marker-layers, .marker-hint {
  border-left: 2px solid rgba(255, 253, 247, 0.22);
  padding-left: 14px;
}
/* Nothing left to take back reads as a greyed step, not a missing button. */
.marker-tool[disabled] { opacity: 0.3; cursor: default; }
.marker-tool[disabled]:hover { color: rgba(255, 253, 247, 0.6); }
/* Which tool is in the hand — the first thing on the bar, and the only part
   of it that stays put when the rubber hides the colours. */
.marker-tool {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid transparent;
  border-radius: 999px;
  background: none;
  color: rgba(255, 253, 247, 0.6);
  cursor: pointer;
  padding: 0;
}
.marker-tool:hover { color: var(--cream); }
.marker-tool.is-current { background: var(--cream); color: var(--ink); }
.marker-tool-glyph { display: block; width: 18px; height: 18px; }
.marker-tool-glyph svg { width: 100%; height: 100%; display: block; }
.marker-ink {
  width: 26px;
  height: 26px;
  border: 3px solid rgba(255, 253, 247, 0.35);
  border-radius: 999px;
  cursor: pointer;
  padding: 0;
}
.marker-ink.is-current { border-color: var(--cream); transform: scale(1.15); }
.marker-nib {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid transparent;
  border-radius: 999px;
  background: none;
  cursor: pointer;
  padding: 0;
}
.marker-nib span { display: block; background: var(--cream); border-radius: 999px; }
.marker-nib.is-current { border-color: var(--cream); background: rgba(255, 253, 247, 0.12); }
.marker-hint {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--mint);
  white-space: nowrap;
}
.marker-done {
  border: none;
  border-radius: 999px;
  background: var(--mint);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 800;
  font-size: 13px;
  padding: 7px 14px;
  cursor: pointer;
  margin-left: 4px;
  white-space: nowrap;
}
.marker-done:hover { background: var(--yellow); }

@media (max-width: 900px) {
  /* Seven inks, three nibs and two tools do not fit a phone on one line, so
     the bar is allowed a second rather than being cut off at both ends. */
  .marker-bar {
    gap: 7px;
    padding: 7px 10px;
    bottom: 74px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: calc(100vw - 24px);
    border-radius: 22px;
  }
  .marker-tools, .marker-history, .marker-inks, .marker-nibs, .marker-layers { gap: 5px; }
  /* Wrapped, the groups are told apart by their own rows; a rule left at the
     start of a line would only read as a stray mark. */
  .marker-history, .marker-inks, .marker-nibs, .marker-layers, .marker-hint {
    border-left: none;
    padding-left: 0;
  }
  .marker-tool { width: 28px; height: 28px; }
  .marker-ink { width: 20px; height: 20px; }
  .marker-nib { width: 24px; height: 24px; }
  .marker-hint { font-size: 11px; }
  .marker-done { font-size: 12px; padding: 6px 12px; margin-left: 0; }
}

/* --------------------------------------------------------------- pinboard */

.board-view {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  --surface: var(--mint);
  --surface-edge: var(--ink);
}
/* Cork rather than the tree's grid: two surfaces that never look alike. */
/* One flat colour with a single grid of small dark dots — dotted paper, not a
   texture. Earlier versions layered several dot sizes, which only read as
   competing grids. */
.board-canvas {
  position: relative;
  transform-origin: 0 0;
  background-color: var(--surface);
  background-image: radial-gradient(rgba(0, 0, 0, 0.2) 1.6px, transparent 1.6px);
  background-size: 26px 26px;
  background-position: 13px 13px;
}

.pin { position: absolute; cursor: move; }
/* While it is actually moving, nothing inside it behaves like text. */
.pin.is-dragging, .pin.is-dragging * { user-select: none; cursor: grabbing; }
.pin .polaroid { padding-bottom: 14px; }
.pin-title {
  font-family: var(--black);
  font-size: 15px;
  line-height: 1.2;
  margin-top: 10px;
  word-break: break-word;
}
.pin-desc {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  margin-top: 5px;
  color: #5d564b;
  word-break: break-word;
}
.place-chip {
  display: inline-block;
  margin-top: 9px;
  padding: 3px 10px 4px;
  background: var(--mint);
  border: 2px solid var(--ink);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  max-width: 100%;
  word-break: break-word;
}
.place-chip.is-empty { background: transparent; border-style: dashed; opacity: 0.55; }
.place-chip::before { content: '⌖ '; opacity: 0.6; }

/* Who pinned it — only worth the room while the pointer is on the card. */
.pin-author {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 6px;
  left: 2px;
  bottom: -26px;
  font-family: var(--mono);
  font-size: 10px;
  color: rgba(0, 0, 0, 0.7);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
  opacity: 0;
  transition: opacity 0.12s;
  pointer-events: none;
  white-space: nowrap;
}
.pin:hover .pin-author { opacity: 1; }

/* A sticker is the picture and nothing more — no frame, no plate, no caption.
   Only a size cap, so a photo straight off a phone cannot swallow the board,
   and a shadow that follows the cut-out edge rather than a box around it. */
.sticker-pin { line-height: 0; position: relative; }
.sticker-pin img {
  display: block;
  max-width: 260px;
  max-height: 260px;
  width: auto;
  height: auto;
  filter: drop-shadow(4px 6px 5px rgba(0, 0, 0, 0.3));
}
/* Sits on the corner of the picture and only shows up under the pointer, the
   same way the note's colour dot does. */
.pin-resize {
  position: absolute;
  right: -11px;
  bottom: -11px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 3px solid var(--ink);
  background: var(--cream);
  cursor: nwse-resize;
  opacity: 0;
  transition: opacity 0.12s;
  padding: 0;
  z-index: 3;
}
.pin-resize::before {
  content: '';
  position: absolute;
  inset: 4px;
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  border-radius: 0 0 3px 0;
}
.pin:hover .pin-resize, .pin-resize:focus-visible { opacity: 1; }
.sticker-pin { position: relative; }

.sticker-missing {
  display: block;
  padding: 18px 22px;
  background: var(--cream);
  border: 3px dashed var(--ink);
  border-radius: 14px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.4;
}

.sticker-sets { display: flex; flex-direction: column; gap: 22px; margin-top: 16px; }
.sticker-set .group-label { margin-bottom: 10px; }
.sticker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 12px;
}
.sticker-choice {
  background: rgba(0, 0, 0, 0.04);
  border: 3px solid transparent;
  border-radius: 16px;
  padding: 8px;
  cursor: pointer;
  line-height: 0;
}
.sticker-choice:hover { border-color: var(--ink); background: var(--note); }
.sticker-choice img { width: 100%; height: auto; display: block; }
.sticker-loading { font-family: var(--mono); font-size: 12px; opacity: 0.6; }

/* An oval badge for naming a corner of the board — a family, a year, a place. */
.label-pill {
  position: relative;
  background: var(--pink);
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: 5px 6px 0 rgba(0, 0, 0, 0.3);
  padding: 10px 26px 12px;
  max-width: 460px;
}
.label-pill[data-color='mint'] { background: var(--mint); }
.label-pill[data-color='yellow'] { background: var(--yellow); }
.label-pill[data-color='cream'] { background: var(--cream); }
.label-text {
  font-family: var(--black);
  font-size: 19px;
  line-height: 1.15;
  text-align: center;
  min-width: 90px;
  cursor: text;
  outline: none;
  word-break: break-word;
}
/* The dot would cover the text inside a pill, so it hangs off the edge — and
   it shows the palette it actually steps through, which is not the notes'. */
.pin--label .note-color {
  right: -9px;
  bottom: -9px;
  background: conic-gradient(var(--pink) 0 25%, var(--mint) 0 50%, var(--yellow) 0 75%, var(--cream) 0);
}

.pin .sticky { position: relative; padding-bottom: 30px; }
.sticky[data-color='mint'] { background: var(--mint); }
.sticky[data-color='pink'] { background: var(--pink); }
.sticky[data-color='yellow'] { background: var(--yellow); }
.sticky-text { min-height: 42px; outline: none; }
.note-color {
  position: absolute;
  right: 10px;
  bottom: 8px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: conic-gradient(var(--note) 0 25%, var(--mint) 0 50%, var(--pink) 0 75%, var(--yellow) 0);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s;
}
.pin:hover .note-color, .note-color:focus-visible { opacity: 1; }

[data-placeholder]:empty::before {
  content: attr(data-placeholder);
  opacity: 0.45;
  font-style: italic;
}

.board-empty {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%) rotate(-1deg);
  width: min(460px, calc(100vw - 48px));
  padding: 26px 28px 30px;
  z-index: 20;
}

/* Reassurance that other people's changes really are arriving. */
.live-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--ink);
  border-radius: 999px;
  padding: 5px 13px 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--mint);
}
.live-chip--off { color: var(--pink); }
.live-chip--wait { color: var(--yellow); }
.live-dot { width: 7px; height: 7px; border-radius: 999px; background: currentColor; }
.live-chip--on .live-dot { animation: live-pulse 2s ease-in-out infinite; }
@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.lightbox-img {
  display: block;
  width: 100%;
  max-height: 62vh;
  object-fit: contain;
  background: #efeade;
  border: 3px solid var(--ink);
  border-radius: 10px;
}
.lightbox-desc { font-weight: 600; font-size: 15px; line-height: 1.5; margin: 14px 0 0; }

/* ------------------------------------------------------------ board sharing */

.member-list { display: flex; flex-direction: column; gap: 10px; }
.member-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  background: #f6f1e4;
  border: 2px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  padding: 10px 14px;
}
.member-mail { font-weight: 800; font-size: 15px; word-break: break-all; }
.member-note { font-family: var(--mono); font-size: 10px; opacity: 0.55; margin-top: 2px; }
.member-controls { display: flex; align-items: center; gap: 8px; }
.role-select {
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--cream);
  font-size: 13px;
  font-weight: 700;
}
.role-tag {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--yellow);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 3px 11px 4px;
}
.share-invite { margin-top: 22px; }
.share-url { width: 100%; font-family: var(--mono); font-size: 13px; }
.self-badge.is-static { cursor: default; }
.share-hint { font-weight: 600; font-size: 14px; line-height: 1.5; opacity: 0.8; margin: 6px 0 12px; }
.field--narrow { max-width: 190px; }

.shared-shelf { margin-top: 42px; }
.shelf-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.shelf-head h2 { margin: 0; }
.tree-card--shared { border-style: dashed; }

/* ------------------------------------------------------------------ avatars */

.avatar {
  width: var(--avatar-size, 34px);
  height: var(--avatar-size, 34px);
  flex: 0 0 auto;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: var(--avatar-tint, var(--mint));
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.28);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-letter {
  font-family: var(--black);
  /* Scales with the circle, so one component covers the badge and the pin. */
  font-size: calc(var(--avatar-size, 34px) * 0.46);
  line-height: 1;
  color: var(--ink);
  user-select: none;
}
/* On the cork the little face needs its own edge to stay legible. */
.pin-author .avatar { border-width: 2px; box-shadow: none; }

.avatar-button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  border-radius: 999px;
  line-height: 0;
}
.avatar-button:hover .avatar { transform: rotate(-4deg); }
.avatar-button .avatar { transition: transform 0.12s; }

.trees-brand { display: flex; align-items: center; gap: 14px; }

.account-identity { display: flex; align-items: center; gap: 14px; }
.account-name { font-weight: 800; font-size: 19px; margin-top: 4px; }
.account-mail { font-family: var(--mono); font-size: 11px; opacity: 0.55; margin-top: 2px; }

.tree-link-list { display: flex; flex-direction: column; gap: 10px; }
.tree-link-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  background: #f6f1e4;
  border: 2px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  padding: 10px 14px;
}
.account-photo { line-height: 0; }
.account-photo-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.account-section .account-photo-actions { margin-top: 4px; }

.member-who { display: flex; align-items: center; gap: 12px; }

/* --------------------------------------------------------- background colour */

.swatch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
  gap: 10px;
}
.swatch {
  height: 52px;
  border: 3px solid var(--ink);
  border-radius: 12px;
  box-shadow: 3px 4px 0 rgba(0, 0, 0, 0.25);
  cursor: pointer;
  padding: 0;
}
.swatch:hover { transform: translate(-1px, -1px); }
/* The chosen one is marked by a ring rather than a tick, which would vanish
   against half the palette. */
.swatch.is-chosen { outline: 3px solid var(--ink); outline-offset: 3px; }
.color-input {
  width: 100%;
  height: 46px;
  padding: 4px;
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: var(--cream);
  cursor: pointer;
}
