/* ==========================================================================
   Dazone v1.0 — styles
   Palette: sage drafting paper, pine ink, teal marker, amber signal.
   ========================================================================== */

/* The hidden attribute must always win over a component's own display value. */
[hidden] { display: none !important; }

:root {
  --paper:        #e9ebe6;
  --paper-2:      #dfe2db;
  --surface:      #fbfcfa;
  --surface-2:    #f1f3ee;
  --surface-3:    #e6e9e2;
  --ink:          #17211d;
  --ink-2:        #4a574f;
  --ink-3:        #7f8b83;
  --line:         #d6dad1;
  --line-2:       #c3c9bd;
  --accent:       #2f6f62;
  --accent-ink:   #ffffff;
  --accent-soft:  rgba(47, 111, 98, .12);
  --accent-line:  rgba(47, 111, 98, .45);
  --amber:        #b8801c;
  --danger:       #a63a2e;
  --danger-soft:  rgba(166, 58, 46, .1);
  --dot:          rgba(23, 33, 29, .17);
  --dot-major:    rgba(23, 33, 29, .30);
  --shadow-1:     0 1px 2px rgba(20, 32, 27, .06), 0 2px 6px rgba(20, 32, 27, .05);
  --shadow-2:     0 2px 6px rgba(20, 32, 27, .08), 0 12px 28px rgba(20, 32, 27, .12);
  --shadow-3:     0 18px 60px rgba(20, 32, 27, .24);
  --note-paper:   #ffffff;
  --note-butter:  #f8efc8;
  --note-sky:     #dbe8f5;
  --note-sage:    #dcead9;
  --note-blush:   #f6dfe0;
  --note-lilac:   #e5e0f3;
  --note-slate:   #e2e6e3;

  --font-ui:    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-mono:  ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --topbar-h: 56px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
}

[data-theme="dark"] {
  --paper:        #131714;
  --paper-2:      #0e120f;
  --surface:      #1b211d;
  --surface-2:    #232b26;
  --surface-3:    #2b342e;
  --ink:          #e7ebe5;
  --ink-2:        #a8b3ab;
  --ink-3:        #78857c;
  --line:         #2e3831;
  --line-2:       #3e4a42;
  --accent:       #5bb6a0;
  --accent-ink:   #0c1512;
  --accent-soft:  rgba(91, 182, 160, .16);
  --accent-line:  rgba(91, 182, 160, .5);
  --amber:        #e0a94e;
  --danger:       #e0705e;
  --danger-soft:  rgba(224, 112, 94, .14);
  --dot:          rgba(231, 235, 229, .13);
  --dot-major:    rgba(231, 235, 229, .26);
  --shadow-1:     0 1px 2px rgba(0, 0, 0, .4);
  --shadow-2:     0 2px 6px rgba(0, 0, 0, .38), 0 14px 30px rgba(0, 0, 0, .44);
  --shadow-3:     0 18px 60px rgba(0, 0, 0, .6);
  --note-paper:   #232b26;
  --note-butter:  #4a421f;
  --note-sky:     #22384a;
  --note-sage:    #263a2c;
  --note-blush:   #46282c;
  --note-lilac:   #322b4a;
  --note-slate:   #2a312d;
}

/* ---------- base ---------- */

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overscroll-behavior: none;
}

body {
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
svg rect, svg circle { fill: none; }
.brand-mark svg rect { fill: currentColor; stroke: none; }
.i-moon path { fill: currentColor; stroke: none; }

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.noscript {
  display: block;
  padding: 24px;
  font-size: 15px;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* ---------- topbar ---------- */

.topbar {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--topbar-h);
  padding: 0 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}

.topbar-left { display: flex; align-items: baseline; gap: 14px; min-width: 0; flex: 1 1 0; }
.topbar-center { display: flex; align-items: center; gap: 10px; flex: 0 1 auto; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 6px; flex: 1 1 0; justify-content: flex-end; }

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
  padding: 4px 6px;
  margin-left: -6px;
  border-radius: var(--r-sm);
}
.brand:hover { background: var(--surface-2); }
.brand-mark { color: var(--accent); align-self: center; display: flex; }
.brand-name {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -.015em;
}
.brand-version {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .08em;
  color: var(--ink-3);
  text-transform: uppercase;
}
.brand-tagline {
  margin: 0;
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: .01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board-name {
  width: 240px;
  max-width: 34vw;
  padding: 6px 10px;
  text-align: center;
  font-size: 14px;
  font-weight: 550;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  text-overflow: ellipsis;
}
.board-name:hover { background: var(--surface-2); }
.board-name:focus { background: var(--surface-2); border-color: var(--line-2); outline: none; text-align: left; }

.save-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px 4px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
}
.save-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); }
.save-pill[data-state="saved"] .save-dot { background: var(--accent); }
.save-pill[data-state="saving"] { color: var(--amber); }
.save-pill[data-state="saving"] .save-dot { background: var(--amber); animation: pulse 1.1s ease-in-out infinite; }
.save-pill[data-state="error"] { color: var(--danger); background: var(--danger-soft); }
.save-pill[data-state="error"] .save-dot { background: var(--danger); }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 11px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background .12s ease, border-color .12s ease, transform .06s ease;
}
.btn:hover { background: var(--surface-2); border-color: var(--line-2); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-icon { width: 32px; padding: 0; justify-content: center; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { background: var(--accent); border-color: var(--accent); filter: brightness(1.08); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn-danger { color: var(--danger); border-color: var(--line); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }

[data-theme="light"] .i-moon,
[data-theme="dark"] .i-sun { display: none; }

/* ---------- tooltips ---------- */

[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-3px);
  padding: 5px 8px;
  border-radius: var(--r-sm);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .02em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease .35s, transform .12s ease .35s;
  z-index: 200;
}
[data-tip]:hover::after { opacity: .96; transform: translateX(-50%) translateY(0); }
.hud [data-tip]::after, .inspector [data-tip]::after { top: auto; bottom: calc(100% + 8px); }
@media (hover: none) { [data-tip]::after { display: none; } }

/* ---------- stage ---------- */

.stage {
  position: relative;
  flex: 1 1 auto;
  overflow: hidden;
  background: var(--paper);
  touch-action: none;
  cursor: default;
  contain: layout paint;
  min-height: 0;
}
.stage.is-panning { cursor: grabbing; }
.stage.can-pan { cursor: grab; }
.stage.is-marquee { cursor: crosshair; }

.grid-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 1px 1px, var(--dot-major) 1.4px, transparent 0),
    radial-gradient(circle at 1px 1px, var(--dot) 1.1px, transparent 0);
  opacity: 1;
  transition: opacity .18s ease;
}
.grid-layer.is-hidden { opacity: 0; }
.grid-layer.no-fine { background-image: radial-gradient(circle at 1px 1px, var(--dot-major) 1.4px, transparent 0); }

.world {
  position: absolute;
  top: 0; left: 0;
  width: 0; height: 0;
  transform-origin: 0 0;
  will-change: transform;
  --inv: 1;
}

/* ---------- nodes ---------- */

.node {
  position: absolute;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
  background: var(--surface);
  color: var(--ink);
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
}
.node.is-selected { box-shadow: var(--shadow-2); }
.node.is-selected::after {
  content: "";
  position: absolute;
  inset: calc(-3px * var(--inv));
  border: calc(1.6px * var(--inv)) solid var(--accent);
  border-radius: calc(var(--r-md) + 3px * var(--inv));
  pointer-events: none;
}
.node.is-dragging { box-shadow: var(--shadow-3); }
.node.is-editing { cursor: text; }

/* note */
.node-note {
  background: var(--note-bg, var(--note-paper));
  border: 1px solid rgba(23, 33, 29, .07);
}
[data-theme="dark"] .node-note { border-color: rgba(255, 255, 255, .06); }
.note-body {
  width: 100%;
  height: 100%;
  padding: 12px 14px;
  overflow: hidden;
  border-radius: inherit;
  white-space: pre-wrap;
  word-break: break-word;
  outline: none;
  cursor: inherit;
  font-family: var(--font-ui);
}
.note-body.is-empty::before {
  content: "Write something…";
  color: var(--ink-3);
  pointer-events: none;
}
.node-note.is-editing .note-body { overflow: auto; user-select: text; -webkit-user-select: text; cursor: text; }
.note-body[data-font="sans"]  { font-family: var(--font-ui); }
.note-body[data-font="serif"] { font-family: var(--font-serif); }
.note-body[data-font="mono"]  { font-family: var(--font-mono); }
.note-body[data-preset="title"]      { font-size: 30px; line-height: 1.16; font-weight: 700; letter-spacing: -.02em; }
.note-body[data-preset="heading"]    { font-size: 22px; line-height: 1.22; font-weight: 650; letter-spacing: -.012em; }
.note-body[data-preset="subheading"] { font-size: 17px; line-height: 1.3;  font-weight: 600; letter-spacing: -.005em; }
.note-body[data-preset="body"]       { font-size: 14px; line-height: 1.55; font-weight: 400; }
.note-body[data-preset="caption"]    { font-size: 11.5px; line-height: 1.45; font-weight: 500; letter-spacing: .03em; color: var(--ink-2); }

/* image */
.node-image { background: var(--surface-2); }
.node-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
  pointer-events: none;
  -webkit-user-drag: none;
}
.node-image .img-missing {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border-radius: inherit;
  padding: 12px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-3);
}

/* file card */
.node-file {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.file-badge {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 42px;
  height: 50px;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  overflow: hidden;
}
.file-meta { min-width: 0; flex: 1 1 auto; overflow: hidden; }
.file-name {
  font-size: 13px;
  font-weight: 550;
  line-height: 1.3;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.file-sub {
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .03em;
  color: var(--ink-3);
  text-transform: uppercase;
}
.file-open {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 500;
  background: var(--surface-2);
}
.file-open:hover { border-color: var(--accent); color: var(--accent); }

/* handles */
.handle {
  position: absolute;
  width: calc(10px * var(--inv));
  height: calc(10px * var(--inv));
  background: var(--surface);
  border: calc(1.6px * var(--inv)) solid var(--accent);
  border-radius: calc(2px * var(--inv));
  z-index: 5;
}
.handle[data-dir="nw"] { top: calc(-5px * var(--inv)); left: calc(-5px * var(--inv)); cursor: nwse-resize; }
.handle[data-dir="ne"] { top: calc(-5px * var(--inv)); right: calc(-5px * var(--inv)); cursor: nesw-resize; }
.handle[data-dir="sw"] { bottom: calc(-5px * var(--inv)); left: calc(-5px * var(--inv)); cursor: nesw-resize; }
.handle[data-dir="se"] { bottom: calc(-5px * var(--inv)); right: calc(-5px * var(--inv)); cursor: nwse-resize; }
.handle[data-dir="n"] { top: calc(-5px * var(--inv)); left: 50%; margin-left: calc(-5px * var(--inv)); cursor: ns-resize; }
.handle[data-dir="s"] { bottom: calc(-5px * var(--inv)); left: 50%; margin-left: calc(-5px * var(--inv)); cursor: ns-resize; }
.handle[data-dir="w"] { left: calc(-5px * var(--inv)); top: 50%; margin-top: calc(-5px * var(--inv)); cursor: ew-resize; }
.handle[data-dir="e"] { right: calc(-5px * var(--inv)); top: 50%; margin-top: calc(-5px * var(--inv)); cursor: ew-resize; }

/* ---------- marquee, drop veil, readout ---------- */

.marquee {
  position: absolute;
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 3px;
  pointer-events: none;
  z-index: 12;
}

/* Dragging files over the canvas outlines the stage. No overlay, no label. */
.stage.is-dropping::after {
  content: '';
  position: absolute;
  inset: 8px;
  z-index: 20;
  border: 2px dashed var(--accent-line);
  border-radius: var(--r-lg);
  background: var(--accent-soft);
  pointer-events: none;
}

.readout {
  position: absolute;
  z-index: 22;
  padding: 4px 7px;
  border-radius: var(--r-sm);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .02em;
  pointer-events: none;
  white-space: nowrap;
}

/* ---------- empty state ---------- */

.empty-state {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(440px, calc(100% - 48px));
  padding: 26px 26px 24px;
  text-align: center;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
  z-index: 6;
  pointer-events: none;
}
.empty-actions { pointer-events: auto; }
.empty-state h2 {
  margin: 0 0 8px;
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -.01em;
}
.empty-state p { margin: 0 0 18px; font-size: 13.5px; line-height: 1.55; color: var(--ink-2); }
.empty-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

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

.hud {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 14;
  display: flex;
  gap: 8px;
}
.hud-group {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
}
.hud-btn {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  color: var(--ink-2);
}
.hud-btn:hover { background: var(--surface-2); color: var(--ink); }
.hud-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.hud-zoom {
  min-width: 52px;
  height: 28px;
  padding: 0 6px;
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-2);
}
.hud-zoom:hover { background: var(--surface-2); color: var(--ink); }

/* ---------- inspector ---------- */

.inspector {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 26;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
  max-width: calc(100vw - 28px);
  overflow-x: auto;
  scrollbar-width: none;
}
.inspector::-webkit-scrollbar { display: none; }
.ins-group { display: flex; align-items: center; gap: 8px; }
.ins-field { display: flex; align-items: center; gap: 6px; }
.ins-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.ins-select {
  height: 28px;
  padding: 0 6px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 12.5px;
}
.ins-divider { width: 1px; height: 22px; background: var(--line); }
.ins-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--r-sm);
  color: var(--ink-2);
}
.ins-btn:hover { background: var(--surface-2); color: var(--ink); }
.ins-danger:hover { background: var(--danger-soft); color: var(--danger); }
.ins-count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .04em;
  color: var(--ink-3);
  padding-right: 2px;
  white-space: nowrap;
}
.swatches { display: flex; gap: 4px; }
.swatch {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  border: 1px solid var(--line-2);
}
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--accent); }

/* ---------- context menu ---------- */

.menu {
  position: fixed;
  z-index: 300;
  min-width: 208px;
  padding: 5px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
  animation: menu-in .1s ease;
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-3px); } }
.menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 9px;
  border-radius: var(--r-sm);
  font-size: 13px;
  text-align: left;
}
.menu-item:hover { background: var(--surface-2); }
.menu-item.is-danger { color: var(--danger); }
.menu-item.is-danger:hover { background: var(--danger-soft); }
.menu-item[disabled] { opacity: .4; pointer-events: none; }
.menu-key {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
  letter-spacing: .03em;
}
.menu-sep { height: 1px; margin: 5px 4px; background: var(--line); }

/* ---------- modals ---------- */

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 400;
}
.modal-layer {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(18, 24, 20, .42);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fade-in .12s ease;
}
[data-theme="dark"] .modal-layer { background: rgba(6, 9, 7, .62); }
@keyframes fade-in { from { opacity: 0; } }
.modal {
  width: 100%;
  max-width: var(--modal-w, 460px);
  max-height: min(86vh, 780px);
  display: flex;
  flex-direction: column;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-3);
  overflow: hidden;
  animation: modal-in .16s cubic-bezier(.2, .8, .3, 1);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.99); } }
.modal-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 20px 12px;
}
.modal-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -.01em;
}
.modal-sub { margin: 5px 0 0; font-size: 13px; line-height: 1.55; color: var(--ink-2); }
.modal-close { margin-left: auto; display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--r-sm); color: var(--ink-3); }
.modal-close:hover { background: var(--surface-2); color: var(--ink); }
.modal-body { padding: 4px 20px 8px; overflow: auto; }
.modal-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  padding: 14px 20px 18px;
}
.modal-foot .spacer { margin-right: auto; }
.field-label {
  display: block;
  margin: 8px 0 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.field-input {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  background: var(--surface-2);
}
.field-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* board gallery */
.gallery-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 0 20px 14px;
}
.search-wrap { position: relative; flex: 1 1 auto; }
.search-wrap svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.search-input {
  width: 100%;
  height: 36px;
  padding: 0 11px 0 32px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  background: var(--surface-2);
}
.search-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: 14px;
  padding-bottom: 6px;
}
.board-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface-2);
  overflow: hidden;
  text-align: left;
  transition: border-color .12s ease, transform .1s ease;
}
.board-card:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.board-card.is-current { border-color: var(--accent); }
.board-open { display: block; width: 100%; text-align: left; }
.board-thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.board-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.board-thumb .thumb-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.board-info { padding: 10px 11px 11px; }
.board-title {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.board-meta {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.board-actions {
  display: flex;
  gap: 2px;
  padding: 0 7px 8px;
}
.card-btn {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  color: var(--ink-3);
}
.card-btn:hover { background: var(--surface-3); color: var(--ink); }
.card-btn.is-danger:hover { background: var(--danger-soft); color: var(--danger); }
.card-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.gallery-empty {
  padding: 34px 10px 40px;
  text-align: center;
  color: var(--ink-2);
  font-size: 13.5px;
}

/* shortcuts + about */
.shortcut-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 26px; }
.shortcut-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.shortcut-row kbd {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .03em;
  color: var(--ink-2);
  white-space: nowrap;
}
.about-tag {
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.45;
  margin: 0 0 12px;
}
.about-list { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.7; color: var(--ink-2); }
.stat-row {
  display: flex;
  gap: 22px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.stat-row b { display: block; font-size: 17px; color: var(--ink); letter-spacing: 0; }

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

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 340px;
  padding: 10px 13px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
  font-size: 13px;
  pointer-events: auto;
  animation: toast-in .18s cubic-bezier(.2, .8, .3, 1);
}
.toast.is-out { animation: toast-out .18s ease forwards; }
.toast-bar { width: 3px; align-self: stretch; border-radius: 2px; background: var(--accent); }
.toast.is-error .toast-bar { background: var(--danger); }
.toast.is-warn .toast-bar { background: var(--amber); }
.toast-action { margin-left: 4px; font-weight: 600; color: var(--accent); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .brand-tagline { display: none; }
}
@media (max-width: 860px) {
  .topbar { gap: 10px; padding: 0 10px; }
  .btn-label { display: none; }
  .btn { padding: 0 9px; }
  .board-name { width: 180px; }
  .hud { left: 10px; bottom: 10px; }
  .inspector { bottom: 60px; }
}
@media (max-width: 620px) {
  .topbar-center .save-pill .save-text { display: none; }
  .save-pill { padding: 4px 6px; }
  .brand-version { display: none; }
  .shortcut-grid { grid-template-columns: 1fr; }
  .board-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media print { .app { display: none; } }
