/* ── Scrollable list ── */
.navigator-list {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.navigator-item {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--ink);
  cursor: pointer;
  padding: 9px 12px;
  text-align: left;
  transition: background 150ms ease, border-color 150ms ease;
  flex-shrink: 0;
}

.navigator-item:hover {
  background: rgba(31, 111, 139, 0.06);
  border-color: rgba(31, 111, 139, 0.1);
}

.navigator-item.active {
  background: #fff;
  border-color: rgba(32, 33, 36, 0.08);
  box-shadow: 0 2px 8px rgba(32, 33, 36, 0.06);
}

.navigator-title {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}

.nav-inline-edit {
  display: block;
  width: 100%;
  border: 1px solid var(--marker);
  border-radius: 6px;
  font-size: 0.82rem;
  padding: 3px 6px;
  background: #fff;
  color: var(--ink);
  outline: none;
  font-weight: 600;
}
.nav-inline-edit:focus {
  box-shadow: 0 0 0 3px rgba(31, 111, 139, 0.15);
}
.nav-inline-edit[hidden] {
  display: none !important;
}

.navigator-meta {
  color: var(--muted);
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-top: 3px;
  text-transform: uppercase;
}


.command-bar input {
  background: rgba(255, 253, 247, 0.92);
  box-shadow: 0 14px 40px rgba(32, 33, 36, 0.08);
  min-height: 52px;
}

#status {
  background: rgba(255, 253, 247, 0.88);
  border: 1px solid var(--line);
  border-radius: 999px;
  max-width: 260px;
  overflow: hidden;
  padding: 0.92rem 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#fileInput { display: none; }

.board {
  grid-area: board;
  height: 100%;
  min-height: 0;
  border: 1px solid rgba(32, 33, 36, 0.08);
  border-radius: 34px;
  padding: 0;
  position: relative;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  background:
    linear-gradient(90deg, rgba(32, 33, 36, 0.038) 1px, transparent 1px),
    linear-gradient(rgba(32, 33, 36, 0.032) 1px, transparent 1px),
    rgba(255, 255, 255, 0.32);
  background-size: 28px 28px;
  box-shadow: inset 0 0 0 8px rgba(255, 255, 255, 0.18), var(--shadow);
}

.board.is-panning, .board.dragging {
  cursor: grabbing;
  user-select: none;
  -webkit-user-select: none;
}

.board.dragging .memory-card {
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.canvas-layer {
  height: 3600px;
  left: 0;
  position: absolute;
  top: 0;
  transform-origin: 0 0;
  width: 3600px;
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.board.dragging::after {
  align-items: center;
  background: rgba(251, 250, 244, 0.88);
  border: 3px dashed var(--marker);
  border-radius: 28px;
  color: var(--marker);
  content: "Drop anywhere";
  display: flex;
  font-family: Georgia, serif;
  font-size: clamp(2rem, 6vw, 5.5rem);
  inset: 16px;
  justify-content: center;
  letter-spacing: -0.06em;
  position: absolute;
  z-index: 20;
}

.capture-canvas {
  --composer-x: 28px;
  --composer-y: 28px;
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 138px;
  position: absolute;
  transform: translate3d(var(--composer-x), var(--composer-y), 0);
  width: min(520px, calc(100vw - 44px));
  z-index: 20;
  border: 1px solid rgba(32, 33, 36, 0.1);
  border-radius: 22px;
  background: rgba(255, 253, 247, 0.82);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  padding: 16px;
  user-select: text;
}

.capture-canvas:not(.is-open) {
  display: none;
}

.capture-canvas.is-writing {
  width: min(680px, calc(100vw - 44px));
}

/* legacy declarations kept intentionally below for older browser cascade safety */
.capture-canvas {
  display: grid;
  grid-template-rows: 1fr auto;
}

.capture-canvas textarea {
  min-height: 46px;
  max-height: 52vh;
  resize: none;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-family: Georgia, serif;
  font-size: clamp(1rem, 1.4vw, 1.35rem);
  letter-spacing: -0.045em;
  line-height: 1.08;
  padding: 0;
}

.capture-canvas textarea::placeholder {
  color: rgba(32, 33, 36, 0.34);
}

.canvas-dock {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto auto;
  margin-top: 10px;
}

.canvas-dock input {
  background: rgba(255, 255, 255, 0.58);
}

.memory-grid {
  height: 3600px;
  inset: 0;
  position: absolute;
  user-select: text;
  width: 3600px;
}

.connections-layer {
  position: absolute;
  inset: 0;
  width: 3600px;
  height: 3600px;
  pointer-events: none;
  z-index: 0;
}

.connection-path {
  fill: none;
  stroke: rgba(31, 111, 139, 0.4);
  stroke-width: 4px;
  stroke-linecap: round;
  marker-end: url(#arrowhead);
}

.snap-guide {
  position: absolute;
  background: #ff4757;
  pointer-events: none;
  z-index: 100;
  display: none;
}

.v-guide { width: 1px; height: 3600px; top: 0; }
.h-guide { height: 1px; width: 3600px; left: 0; }

.board.is-connecting .memory-card {
  cursor: crosshair !important;
}

.memory-card {
  background: var(--warm);
  border: 1.5px solid rgba(32, 33, 36, 0.08);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07), 0 0 0 0 transparent;
  display: flex;
  flex-direction: column;
  min-height: 150px;
  min-width: 180px;
  overflow: hidden;
  position: absolute;
  top: 0; left: 0;
  width: var(--card-w);
  height: var(--card-h);
  transform: translate3d(var(--card-x), var(--card-y), 0) scale(1) rotate(var(--card-r, 0deg));
  transform-origin: center center;
  transition: box-shadow 0.2s ease, outline 0.15s ease;
  will-change: auto;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  z-index: 1;
  border-color: var(--card-border, rgba(32, 33, 36, 0.08));
}

.memory-card:hover {
  box-shadow: 0 8px 28px rgba(0,0,0,0.13);
}

.memory-card:nth-child(3n + 1) { background: var(--green); }
.memory-card:nth-child(3n + 2) { background: var(--blue); }
.memory-card.is-moving, .memory-card.is-resizing {
  cursor: grabbing;
  box-shadow: 0 24px 70px rgba(32, 33, 36, 0.2);
  z-index: 5;
  transition: none;
}

.memory-card.spotlight {
  animation: spotlight 1200ms ease both;
}

.memory-card.selected {
  outline: 2.5px solid var(--card-border, rgba(31, 111, 139, 0.6));
  outline-offset: 3px;
  z-index: 8;
}

.memory-card.grouped {
  box-shadow: var(--shadow), 0 0 0 2px color-mix(in srgb, var(--card-border, #1f6f8b) 42%, transparent);
}

.memory-card.is-uploading {
  outline: 3px dashed rgba(223, 108, 69, 0.42);
  outline-offset: 4px;
}

.memory-card.upload-error {
  outline-color: rgba(161, 73, 45, 0.78);
}

.selection-marquee {
  background: rgba(31, 111, 139, 0.12);
  border: 1px solid rgba(31, 111, 139, 0.55);
  border-radius: 6px;
  pointer-events: none;
  position: absolute;
  z-index: 70;
}

.memory-card.marquee-hover {
  outline: 3px solid var(--marker);
  outline-offset: 3px;
}

@keyframes spotlight {
  0%, 100% { outline: 0 solid rgba(31, 111, 139, 0); }
  24% { outline: 8px solid rgba(31, 111, 139, 0.22); }
}
