/* Minimal look: the images are the only thing that should stand out.
   Dark mode is the default; light mode swaps these colours (body[data-theme="light"]). */

:root, body[data-theme="dark"] {
  --bg: #1b1b1d;            /* board and pane background */
  --gap: #08080a;           /* the lines between panes */
  --line: #26262b;          /* thin separators */
  --input: #141416;         /* text boxes and the top bar */
  --card: #222226;          /* cards and chips */
  --panel: #2a2a2f;         /* menus */
  --panel-2: #202024;       /* settings panels */
  --panel-border: #3a3a40;
  --border-strong: #4a4a52;
  --overlay: rgba(24, 24, 27, 0.9);  /* floating bars over a pane */
  --dot: #34343a;           /* background dots */
  --text: #8a8a90;
  --text-strong: #c8c8cc;
  --accent: #4da3ff;
  color-scheme: dark;
}
body[data-theme="light"] {
  --bg: #f1f1ef;
  --gap: #c9c9c6;
  --line: #dcdcd8;
  --input: #ffffff;
  --card: #ffffff;
  --panel: #ffffff;
  --panel-2: #f7f7f5;
  --panel-border: #d6d6d2;
  --border-strong: #b5b5b0;
  --overlay: rgba(255, 255, 255, 0.92);
  --dot: #c4c4c0;
  --text: #6c6c70;
  --text-strong: #1f1f22;
  --accent: #2f86e8;
  color-scheme: light;
}

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--gap);
  color: var(--text);
  font: 13px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "cv11", "ss01";
  user-select: none;
}

button { font: inherit; color: inherit; }

#stage, #stage canvas {
  position: fixed;
  inset: 0;
  display: block;
}

/* ---------- Panes ---------- */

#panes { position: fixed; inset: 0; }
#panes.panning, #panes.panning * { cursor: grabbing !important; }
#panes.can-pan .pane { cursor: grab; }

.pane {
  position: absolute;
  touch-action: none;
}

/* The pane buttons appear in the top-right corner when the mouse is over the pane. */
.pane-tools {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 2px;
  padding: 2px;
  border-radius: 6px;
  background: var(--overlay);
  opacity: 0;
  transition: opacity 0.15s;
}
.pane:hover .pane-tools { opacity: 1; }
.pane.narrow .pane-tools { display: none; }
#panes.panning .pane-tools { opacity: 0; }

/* With only one pane there's nothing to close or maximize. */
#panes.single .pane-tools [data-action="close"],
#panes.single .pane-tools [data-action="maximize"] { display: none; }

.pane-tools button {
  width: 24px;
  height: 24px;
  padding: 4px;
  border: 0;
  border-radius: 4px;
  background: none;
  cursor: pointer;
}
.pane-tools button:hover { background: rgba(255, 255, 255, 0.1); color: var(--text-strong); }
.pane-tools svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pane-zoom {
  position: absolute;
  right: 8px;
  bottom: 5px;
  font-size: 11px;
  opacity: 0.5;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}
.pane.narrow .pane-zoom { display: none; }

/* ---------- Tool panes (search, mannequin) ---------- */

.pane-editor { position: absolute; inset: 0; }
.pane[data-type="board"] .pane-editor { display: none; }
.pane:not([data-type="board"]) { background: var(--bg); }
.pane:not([data-type="board"]) .pane-zoom { display: none; }
/* Tool panes keep their buttons a little visible so you can always switch back. */
.pane:not([data-type="board"]) .pane-tools { opacity: 0.55; }
.pane:not([data-type="board"]):hover .pane-tools { opacity: 1; }

.pane-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 16px;
  text-align: center;
}

.search-pane {
  display: flex;
  flex-direction: column;
  height: 100%;
  user-select: none;
}
.search-bar {
  display: flex;
  gap: 6px;
  padding: 8px 150px 8px 8px;  /* room for the pane buttons on the right */
  border-bottom: 1px solid var(--panel-border);
}
.pane.narrow .search-bar { padding-right: 8px; }
.search-source, .search-input, .key-row input {
  min-width: 0;
  padding: 5px 8px;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: var(--input);
  color: var(--text-strong);
  font: inherit;
  outline: none;
}
.search-source { flex: none; }
.search-input { flex: 1; }
.search-source:focus, .search-input:focus, .key-row input:focus { border-color: var(--accent); }
.search-gear {
  flex: none;
  width: 30px;
  padding: 6px;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: none;
  cursor: pointer;
}
.search-gear:hover { color: var(--text-strong); background: var(--panel); }
.search-gear svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; }

.search-settings {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--panel-border);
  background: var(--panel-2);
}
.search-settings[hidden] { display: none; }
.search-settings p { margin: 0; }
.search-settings a { color: var(--accent); }
.key-row { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.search-settings .text-button { align-self: flex-start; }

.search-scroll { flex: 1; overflow-y: auto; padding: 8px; }
.search-results { columns: 160px; column-gap: 8px; }
.result {
  position: relative;
  margin: 0 0 8px;
  break-inside: avoid;
  border-radius: 6px;
  overflow: hidden;
  background: var(--card);
  cursor: grab;
}
.result img { display: block; width: 100%; height: auto; min-height: 40px; }
/* Hover buttons on a search result */
.result-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 5px;
  padding: 8px;
  background: linear-gradient(transparent 45%, rgba(0, 0, 0, 0.72));
  opacity: 0;
  transition: opacity 0.15s;
}
.result:hover .result-overlay, .result:focus-within .result-overlay { opacity: 1; }
.result-overlay button {
  padding: 4px 10px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.result-add { background: var(--accent); color: #fff; font-weight: 500; }
.result-add:hover { filter: brightness(1.1); }
.result-more { background: rgba(255, 255, 255, 0.9); color: #1b1b1d; }
.result-more:hover { background: #fff; }
.result-overlay figcaption {
  max-width: 100%;
  color: #eee;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.result:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
.result.narrow-card .result-more { display: none; }

/* Suggested words under the search box */
.search-chips {
  display: flex;
  gap: 6px;
  padding: 0 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.search-chips:not(:empty) { padding-top: 8px; padding-bottom: 2px; }
.chip {
  flex: none;
  padding: 4px 11px;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: var(--card);
  color: var(--text-strong);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.chip:hover { background: var(--panel); border-color: var(--border-strong); }

/* Tabs: Search | Mood board, and the Sources button */
.search-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 150px 0 8px;   /* room for the pane buttons on the right */
  border-bottom: 1px solid var(--panel-border);
}
.pane.narrow .search-tabs { padding-right: 8px; }
.search-tabs button {
  padding: 6px 10px 7px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.search-tabs button:hover { color: var(--text-strong); }
.search-tabs button.active { color: var(--text-strong); border-bottom-color: var(--accent); }
.search-tabs .sources-button { margin-left: auto; }
.search-tabs .sources-button.active { border-bottom-color: var(--text); }

.tab-search, .tab-mood { display: none; flex: 1; min-height: 0; flex-direction: column; }
.search-pane[data-tab="search"] .tab-search, .search-pane[data-tab="mood"] .tab-mood { display: flex; }
.tab-search .search-bar, .mood-bar { padding-right: 8px; border-bottom: 0; }

/* All / Photos / Art / Nature, then the suggested words */
.search-filters { display: flex; align-items: center; gap: 8px; padding: 0 8px 4px; min-width: 0; }
.kind-filter { flex: none; display: flex; border: 1px solid var(--panel-border); border-radius: 999px; overflow: hidden; }
.kind-filter button {
  padding: 3px 10px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.kind-filter button + button { border-left: 1px solid var(--panel-border); }
.kind-filter button.active { background: var(--panel); color: var(--text-strong); }
.search-filters .search-chips { flex: 1; min-width: 0; padding: 0; }
.search-filters .search-chips:not(:empty) { padding: 0; }

/* Mood board tab */
.mood-bar { display: flex; gap: 6px; padding: 8px; }
.mood-input, .mood-count {
  min-width: 0;
  padding: 5px 8px;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: var(--input);
  color: var(--text-strong);
  font: inherit;
  outline: none;
}
.mood-input { flex: 1; }
.mood-input:focus { border-color: var(--accent); }
.mood-make, .mood-add {
  flex: none;
  padding: 5px 12px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.mood-make:disabled, .mood-add:disabled { opacity: 0.6; cursor: default; }
.mood-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-top: 1px solid var(--panel-border);
}
.mood-actions[hidden] { display: none; }
.mood-actions .mood-note { flex: 1; font-size: 12px; }
.mood-actions .text-button { padding: 5px 12px; }
.result-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--overlay);
  color: #fff;
  font-size: 15px;
  line-height: 22px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
.result:hover .result-remove { opacity: 1; }
.result-remove:hover { background: #d64545; }
.search-pane.compact .mood-make { padding: 5px 8px; }

/* Sources in the search settings */
.source-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 16px; max-height: 50vh; overflow-y: auto; }
.source-row { display: flex; flex-direction: column; gap: 4px; }
.source-toggle strong { font-weight: 500; }
.source-toggle { display: flex; align-items: center; gap: 4px; color: var(--text-strong); }
.source-toggle input { accent-color: var(--accent); }
.source-row .small { font-size: 11px; opacity: 0.7; margin-left: 20px; line-height: 1.4; }
.source-row .key-row { margin-left: 20px; }

.search-status { padding: 12px 4px; text-align: center; }
.search-status p { margin: 0 auto 8px; max-width: 360px; }
.search-status .small { font-size: 12px; opacity: 0.7; }
.search-end { height: 1px; }

/* ---------- 3D mannequin pane ---------- */

.mannequin-pane { position: absolute; inset: 0; overflow: hidden; user-select: none; }
.mq-canvas { position: absolute; inset: 0; display: block; }
.mq-bar {
  position: absolute;
  left: 8px;
  right: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  pointer-events: none;   /* only the controls themselves catch the mouse */
}
.mq-bar > * { pointer-events: auto; }
.mq-top { top: 8px; right: 150px; }   /* room for the pane buttons */
.mq-bottom { bottom: 8px; font-size: 12px; }
.mq-flex { flex: 1; pointer-events: none; }
.mq-sep { width: 1px; height: 18px; background: var(--panel-border); pointer-events: none; }
.mq-bar .text-button[hidden] { display: none; }
.mq-bar .text-button:disabled { opacity: 0.45; cursor: default; }
.mq-bar select, .mq-bar .text-button {
  padding: 4px 8px;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: var(--overlay);
  color: var(--text-strong);
  font: inherit;
  font-size: 12px;
}
.mq-bar .text-button:hover { background: var(--panel); }
.text-button.primary { background: var(--accent) !important; border-color: var(--accent) !important; color: #fff !important; }
.text-button.primary:hover { filter: brightness(1.1); }
.mq-bottom label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--overlay);
  color: var(--text-strong);
}
.mq-bottom label select { padding: 1px 4px; border: 0; background: none; }
.mq-bottom input[type="range"] { width: 80px; accent-color: var(--accent); }
/* Typing a pose */
.mq-ai {
  position: absolute;
  top: 44px;
  left: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  max-width: 620px;
}
.mq-ai-input {
  flex: 1;
  min-width: 0;
  padding: 5px 9px;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: var(--overlay);
  color: var(--text-strong);
  font: inherit;
  font-size: 12px;
  outline: none;
}
.mq-ai-input:focus { border-color: var(--accent); }
.mq-ai .text-button {
  padding: 4px 9px;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: var(--overlay);
  color: var(--text-strong);
  font-size: 12px;
  cursor: pointer;
}
.mq-ai .text-button:disabled { opacity: 0.5; cursor: default; }
.mannequin-pane.compact .mq-ai-claude { display: none; }
.mq-ai-key svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; vertical-align: -2px; }
.mq-ai-status {
  position: absolute;
  top: 78px;
  left: 8px;
  max-width: min(620px, calc(100% - 16px));
  padding: 4px 9px;
  border-radius: 6px;
  background: var(--overlay);
  color: var(--text-strong);
  font-size: 12px;
}
.mq-ai-status[hidden], .mq-ai-settings[hidden] { display: none; }
.mq-ai-status[data-kind="error"] { color: #ff9b9b; }
.mq-ai-status[data-kind="busy"]::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 7px;
  border: 2px solid var(--accent);
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -1px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.mq-ai-settings {
  position: absolute;
  top: 78px;
  left: 8px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(420px, calc(100% - 16px));
  box-sizing: border-box;
  padding: 12px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--panel-2);
  font-size: 12px;
}
.mq-ai-settings p { margin: 0; line-height: 1.5; }
.mq-ai-settings a { color: var(--accent); }
.mq-ai-settings .text-button { align-self: flex-start; padding: 4px 10px; border: 1px solid var(--panel-border); border-radius: 6px; background: none; color: var(--text-strong); cursor: pointer; }

.mq-selected {
  position: absolute;
  bottom: 44px;
  left: 8px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  pointer-events: none;
}
.mq-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 44px;
  font-size: 11px;
  text-align: center;
  opacity: 0.55;
  pointer-events: none;
}
.mannequin-pane.compact .mq-hint, .mannequin-pane.has-selection .mq-hint { display: none; }
.mannequin-pane.compact .mq-bottom input[type="range"] { width: 56px; }
.pane.narrow .mq-top { right: 8px; }

/* With several panes, each gets a soft edge so the split is easy to see:
   a faint outline and a gentle shadow inside its border. */
#panes:not(.single) .pane::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07), inset 0 0 22px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}
body[data-tone="light"] #panes:not(.single) .pane::before {
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1), inset 0 0 22px rgba(0, 0, 0, 0.09);
}
.pane-tools, .pane-zoom { z-index: 2; }

/* Dividers: the gap between panes, which you can drag. A line shows on hover. */
.divider { position: absolute; z-index: 2; }
.divider::before { content: ""; position: absolute; }
.divider.row { cursor: col-resize; }
.divider.col { cursor: row-resize; }
.divider.row::before { inset: 0 -3px; }
.divider.col::before { inset: -3px 0; }
.divider::after { content: ""; position: absolute; background: var(--accent); opacity: 0; transition: opacity 0.15s; }
.divider.row::after { left: 2px; right: 2px; top: 0; bottom: 0; border-radius: 2px; }
.divider.col::after { top: 2px; bottom: 2px; left: 0; right: 0; border-radius: 2px; }
.divider:hover::after, .divider.dragging::after { opacity: 1; }

/* ---------- Which screen is showing ---------- */

body[data-mode="home"] #stage,
body[data-mode="home"] #panes,
body[data-mode="home"] #board-bar,
body[data-mode="home"] #empty-hint,
body[data-mode="home"] #toolbar,
body[data-mode="home"] #brush-cursor { display: none; }
body[data-mode="board"] #home { display: none; }

/* ---------- Top bar on a board ---------- */

#board-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  box-sizing: border-box;
  height: 34px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 6px;
  border-bottom: 1px solid var(--line);
  background: var(--input);
}

#home-button, #board-menu-button, #bar-theme-button, #present-button {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 8px;
  border: 0;
  border-radius: 5px;
  background: none;
  font-size: 12px;
  cursor: pointer;
}
#home-button:hover, #board-menu-button:hover, #bar-theme-button:hover, #present-button:hover { background: rgba(255, 255, 255, 0.08); color: var(--text-strong); }
#home-button svg, #board-menu-button svg, #present-button svg, .brand svg, .board-card.new svg, .board-card .more svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
}
#board-menu-button svg { fill: currentColor; stroke: none; }
.bar-sep { opacity: 0.4; }
.bar-flex { flex: 1; }

#board-name {
  width: min(320px, 40vw);
  padding: 3px 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: none;
  color: var(--text-strong);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  text-overflow: ellipsis;
  outline: none;
}
#board-name:hover { border-color: var(--panel-border); }
#board-name:focus { border-color: var(--accent); background: var(--bg); }

@media (max-width: 520px) {
  #home-button span, #present-button span, .bar-sep { display: none; }
}

/* ---------- Home screen ---------- */

#home {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  background: var(--bg);
  user-select: none;
}

.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1040px;
  margin: 0 auto;
  padding: 18px 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-strong);
  font-weight: 500;
}

.text-button {
  padding: 5px 10px;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: none;
  color: var(--text-strong);
  cursor: pointer;
}
.text-button:hover { background: var(--panel); }

.home-main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 24px 24px 64px;
}
.home-main h1 {
  margin: 0 0 20px;
  color: var(--text-strong);
  font-size: 22px;
  font-weight: 600;
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

.board-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: var(--card);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  outline: none;
  transition: border-color 0.15s, transform 0.15s;
}
.board-card:hover, .board-card:focus-visible { border-color: var(--border-strong); }
.board-card:active { transform: scale(0.99); }

.board-card .thumb {
  aspect-ratio: 16 / 10;
  background: var(--bg) center / cover no-repeat;
  border-bottom: 1px solid var(--panel-border);
}
.board-card .thumb.empty { background-image: radial-gradient(circle, var(--dot) 1px, transparent 1px); background-size: 14px 14px; }
.board-card.new .thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  color: var(--text);
}
.board-card.new .thumb svg { width: 28px; height: 28px; stroke-width: 1; }
.board-card.new:hover .thumb { color: var(--text-strong); }

.board-card .meta { padding: 10px 12px 12px; min-width: 0; }
.board-card .name {
  color: var(--text-strong);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.board-card .when { font-size: 12px; margin-top: 2px; }
.board-card .name-input {
  width: 100%;
  box-sizing: border-box;
  padding: 1px 4px;
  margin: -2px -5px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text-strong);
  font: inherit;
  font-weight: 500;
  outline: none;
}

.board-card .more {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  padding: 6px;
  border: 0;
  border-radius: 6px;
  background: var(--overlay);
  color: var(--text-strong);
  opacity: 0;
  cursor: pointer;
  transition: opacity 0.15s;
}
.board-card .more svg { fill: currentColor; stroke: none; }
.board-card:hover .more, .board-card:focus-within .more { opacity: 1; }
.board-card .more:hover { background: var(--panel); }

.home-note {
  max-width: 560px;
  margin: 40px 0 0;
  font-size: 12px;
  line-height: 1.6;
  opacity: 0.75;
}
.home-note code { font-size: 11px; color: var(--text-strong); }
.home-note em { font-style: normal; color: var(--text-strong); }

@media (max-width: 520px) {
  .home-header, .home-main { padding-left: 16px; padding-right: 16px; }
  .board-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
}

/* ---------- Drawing toolbar ---------- */

#toolbar {
  position: fixed;
  left: 50%;          /* always the bottom middle of the window */
  bottom: 12px;
  z-index: 4;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: var(--overlay);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  max-width: calc(100vw - 24px);
}
.tool-group { display: flex; align-items: center; gap: 2px; }
.tool-group + .tool-group { padding-left: 4px; border-left: 1px solid var(--panel-border); }

.tool {
  width: 30px;
  height: 30px;
  padding: 6px;
  border: 0;
  border-radius: 6px;
  background: none;
  cursor: pointer;
}
.tool:hover:not(:disabled) { background: rgba(255, 255, 255, 0.08); color: var(--text-strong); }
.tool.active { background: var(--accent); color: #fff; }
.tool:disabled { opacity: 0.3; cursor: default; }
.tool svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.swatch {
  position: relative;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: var(--c);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  cursor: pointer;
}
.swatch.active { border-color: var(--text-strong); }
.swatch.custom {
  overflow: hidden;
  background: conic-gradient(#ff5a5a, #ffe14d, #4cd07d, #4da3ff, #b57bff, #ff5a5a);
}
.swatch.custom::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--c, transparent); }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* The size slider only matters for the pen and eraser. */
#toolbar .size input { width: 90px; accent-color: var(--accent); }

/* The colour palette opens above the toolbar */
#toolbar { overflow: visible; }
.colour-palette {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(5, 22px);
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}
.colour-palette[hidden] { display: none; }
.colour-palette .swatch { width: 22px; height: 22px; }
.swatch.current-colour { width: 24px; height: 24px; margin: 0 3px; }

/* Folded away: just a small pill with the tool in use */
#toolbar .tool.mini { display: none; width: auto; padding: 6px 8px; gap: 6px; align-items: center; }
#toolbar.collapsed .tool-group, #toolbar.collapsed .colour-palette { display: none; }
#toolbar.collapsed .tool.mini { display: flex; }
#toolbar.collapsed { padding: 2px; }
.mini-colour { width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25); }
.tool-group.fold .tool svg { width: 16px; height: 16px; }
#toolbar[data-tool="select"] .size,
#toolbar[data-tool="hand"] .size,
#toolbar[data-tool="note"] .size,
#toolbar[data-tool="text"] .size,
#toolbar[data-tool="frame"] .size { display: none; }
#toolbar.no-board { display: none; }
#toolbar { transition: opacity 0.2s; }
#toolbar.away { opacity: 0; pointer-events: none; }

/* Cursors for each tool */
#panes[data-tool="pen"] .pane,
#panes[data-tool="eraser"] .pane { cursor: none; }
#panes[data-tool="note"] .pane, #panes[data-tool="text"] .pane { cursor: text; }
#panes[data-tool="hand"] .pane { cursor: grab; }
#panes[data-tool="hand"].panning .pane { cursor: grabbing; }
#panes.can-pan .pane { cursor: grab !important; }

#brush-cursor {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 5;
  display: none;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}
#brush-cursor.eraser { border-style: dashed; }

/* The text box shown while typing into a note */
.note-editor {
  position: fixed;
  z-index: 6;
  box-sizing: border-box;
  margin: 0;
  border: 0;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  resize: none;
  overflow: hidden;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  field-sizing: content;  /* grow with the text (Chrome) */
}

/* ---------- Right-click menu ---------- */

.menu {
  position: fixed;
  z-index: 10;
  min-width: 220px;
  max-height: calc(100vh - 8px);   /* a long menu scrolls instead of running off screen */
  overflow-y: auto;
  box-sizing: border-box;
  padding: 4px;
  border: 1px solid var(--panel-border);
  border-radius: 7px;
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.menu-item {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
  padding: 4px 10px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--text-strong);
  text-align: left;
  cursor: pointer;
}
.menu-item:hover:not(:disabled) { background: var(--accent); color: #fff; }
.menu-item:disabled { opacity: 0.35; cursor: default; }
.menu-item kbd { border: 0; padding: 0; color: inherit; opacity: 0.6; }
.menu-sep { height: 1px; margin: 4px 6px; background: var(--panel-border); }

/* ---------- Hints and messages ---------- */

#empty-hint {
  position: fixed;
  inset: 0;          /* moved over the board pane by src/main.js */
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  text-align: center;
  padding: 0 16px;
}
#empty-hint p { margin: 4px 0; }
#empty-hint strong { color: var(--text-strong); font-weight: 500; }
#empty-hint .small { font-size: 12px; opacity: 0.7; }
#empty-hint.hidden { display: none; }

kbd {
  font: inherit;
  font-size: 11px;
  padding: 1px 5px;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  color: var(--text-strong);
}

/* Outline shown over the whole window while you drag files in */
body.drag-over::after {
  content: "";
  position: fixed;
  inset: 6px;
  border: 2px dashed var(--accent);
  border-radius: 8px;
  pointer-events: none;
  z-index: 20;
}

#toast {
  position: fixed;
  left: 50%;
  bottom: 64px;
  z-index: 20;
  transform: translateX(-50%);
  max-width: min(480px, calc(100vw - 32px));
  padding: 8px 14px;
  border-radius: 6px;
  background: var(--panel);
  color: var(--text-strong);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
#toast.show { opacity: 1; }

.home-actions { display: flex; gap: 8px; }
#theme-button { display: flex; align-items: center; padding: 5px 8px; }
#theme-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.3; }
.home-version { margin-top: 10px; font-size: 11px; opacity: 0.5; }

/* Light/dark switch in the top bar: shows the sun in dark mode, the moon in light mode */
#bar-theme-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; }

/* Folded toolbar: a single, clear "show" button */
#toolbar.collapsed .tool.mini { width: 40px; height: 30px; justify-content: center; padding: 0; }
#toolbar.collapsed .tool.mini svg { width: 18px; height: 18px; stroke-width: 1.8; }

/* ---------- The bar above a selection ---------- */
#selection-bar {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 4;
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-l);
  background: var(--overlay);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
#selection-bar[hidden] { display: none; }
#selection-bar button {
  width: 30px;
  height: 30px;
  padding: 7px;
  border: 0;
  border-radius: var(--radius-s);
  background: none;
  cursor: pointer;
}
#selection-bar button[hidden] { display: none; }
#selection-bar button:hover { background: rgba(127, 127, 127, 0.16); color: var(--text-strong); }
#selection-bar button[data-action="delete"]:hover { color: #e5484d; }
#selection-bar svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }

/* Cursors over the scale and rotate handles */
#panes[data-handle="nwse"] .pane { cursor: nwse-resize !important; }
#panes[data-handle="nesw"] .pane { cursor: nesw-resize !important; }
#panes[data-handle="rotate"] .pane { cursor: alias !important; }

/* ---------- Rounded corners everywhere ---------- */
:root { --radius-s: 6px; --radius: 8px; --radius-l: 12px; }
#toolbar { border-radius: var(--radius-l); }
.menu { border-radius: var(--radius-l); }
.menu-item { border-radius: var(--radius-s); }
.board-card { border-radius: var(--radius-l); }
.text-button, .chip, .search-input, .mood-input, .mood-count, .key-row input { border-radius: var(--radius); }
.result { border-radius: var(--radius); }
#toast { border-radius: var(--radius-l); }
.pane-tools { border-radius: var(--radius); }
/* Panes get rounded corners too: a ring in the gap colour, clipped by the pane. */
.pane { overflow: hidden; }
/* The space between panes is one shape drawn over everything (see src/liquid.js):
   soft corners, and edges that ripple for a moment when panes split or close. */
.pane-edges {
  position: absolute;
  inset: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}
.pane-edges path { fill: var(--gap); }
body.presenting .pane-edges { display: none; }
.home-note a { color: var(--accent); }

/* Typing free text: no background, just a soft outline */
.note-editor.free-text { outline: 1.5px dashed var(--accent); outline-offset: 4px; }

/* ---------- Text controls in the selection bar ---------- */
.sel-text { display: flex; align-items: center; gap: 2px; padding-right: 4px; margin-right: 2px; border-right: 1px solid var(--panel-border); position: relative; }
.sel-text[hidden] { display: none; }
.sel-text select {
  height: 28px;
  max-width: 140px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  background: none;
  color: var(--text-strong);
  font: inherit;
  font-size: 12px;
  outline: none;
  cursor: pointer;
}
.sel-text select:hover { background: rgba(127, 127, 127, 0.16); }
.sel-text select[hidden] { display: none; }
.sel-text button { font: inherit; font-size: 14px; line-height: 1; color: var(--text); }
.sel-text button.on { background: rgba(77, 163, 255, 0.18); color: var(--accent); }
.sel-text .sel-colour { padding: 0; display: flex; align-items: center; justify-content: center; }
.sel-text .sel-colour::before { content: ""; width: 16px; height: 16px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(127, 127, 127, 0.45); }
.sel-palette {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  grid-template-columns: repeat(5, 22px);
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-l);
  background: var(--panel);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}
.sel-palette[hidden] { display: none; }
.sel-palette .swatch { width: 22px; height: 22px; }
.sel-palette .custom-input { padding: 0; border: 0; background: conic-gradient(#ff5a5a, #ffe14d, #4cd07d, #4da3ff, #b57bff, #ff5a5a); cursor: pointer; }
.sel-palette .custom-input::-webkit-color-swatch-wrapper { padding: 0; opacity: 0; }

.shape-picker {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-l);
  background: var(--panel);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}
.shape-picker[hidden] { display: none; }
#panes[data-tool="shape"] .pane, #panes[data-tool="frame"] .pane { cursor: crosshair; }

/* ---------- Present mode ---------- */

#present-button svg { fill: currentColor; stroke: none; }
body[data-tone="light"] #present-button:hover,
body[data-tone="light"] #home-button:hover,
body[data-tone="light"] #board-menu-button:hover,
body[data-tone="light"] #bar-theme-button:hover { background: rgba(0, 0, 0, 0.06); }

/* Everything but the board goes away while presenting. */
body.presenting #board-bar,
body.presenting #toolbar,
body.presenting #selection-bar,
body.presenting #brush-cursor,
body.presenting #empty-hint,
body.presenting .pane-tools,
body.presenting .pane-zoom,
body.presenting .divider { display: none !important; }
body.presenting .pane { border-radius: 0; }
body.presenting #panes { cursor: pointer; }

#present-hud {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 20;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: var(--overlay);
  color: var(--text-strong);
  font-size: 12px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
  transition: opacity 0.4s;
}
#present-hud[hidden] { display: none; }
#present-hud.faded:not(:hover) { opacity: 0; }
#present-hud button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: inherit;
  cursor: pointer;
}
#present-hud button:hover { background: rgba(128, 128, 128, 0.18); }
#present-hud svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.present-where { padding: 0 8px; min-width: 60px; text-align: center; white-space: nowrap; max-width: 50vw; overflow: hidden; text-overflow: ellipsis; }

/* The box for renaming a frame, right over its name */
.frame-rename {
  position: fixed;
  z-index: 15;
  min-width: 120px;
  padding: 1px 4px;
  margin: -2px 0 0 -5px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--input);
  color: var(--text-strong);
  font-family: Inter, system-ui, sans-serif;
  line-height: 1.3;
  outline: none;
}

/* ---------- Board tabs ---------- */

#board-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
#board-tabs::-webkit-scrollbar { display: none; }
.tab {
  display: flex;
  align-items: center;
  flex: 0 1 auto;
  min-width: 70px;
  max-width: 200px;
  height: 26px;
  padding: 0 2px 0 8px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}
.tab:hover { background: rgba(128, 128, 128, 0.12); color: var(--text-strong); }
.tab.active { background: var(--bg); color: var(--text-strong); cursor: default; box-shadow: inset 0 0 0 1px var(--line); }
.tab-name { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tab #board-name { flex: 1; width: 100%; min-width: 0; padding: 2px 4px; margin-left: -4px; }
.tab-close {
  display: grid;
  place-items: center;
  flex: none;
  width: 20px;
  height: 20px;
  margin-left: 2px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: inherit;
  opacity: 0;
  cursor: pointer;
}
.tab:hover .tab-close, .tab.active .tab-close { opacity: 0.6; }
.tab-close:hover { opacity: 1 !important; background: rgba(128, 128, 128, 0.2); }
.tab-close svg, #tab-add svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
#tab-add {
  display: grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: inherit;
  cursor: pointer;
}
#tab-add:hover { background: rgba(128, 128, 128, 0.12); color: var(--text-strong); }
#tab-add svg { width: 14px; height: 14px; }

/* Which board a pane shows (only when panes show different boards) */
.pane-label {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 2;
  max-width: calc(100% - 140px);
  padding: 3px 9px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius, 6px);
  background: var(--overlay);
  color: var(--text);
  font: inherit;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.pane-label.active { border-color: var(--accent); color: var(--text-strong); }
.pane-label[hidden], .pane.narrow .pane-label, body.presenting .pane-label { display: none; }

/* The "is it safe?" line on the home screen */
#safety-note.warn { color: #e0a040; }

/* ---------- Stars ---------- */

#selection-bar button[data-action="star"].on { color: #ffc83d; }
#selection-bar button[data-action="star"].on svg { fill: #ffc83d; }
#star-button {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 8px;
  border: 0;
  border-radius: 5px;
  background: none;
  color: inherit;
  font-size: 12px;
  cursor: pointer;
}
#star-button:hover { background: rgba(128, 128, 128, 0.12); color: var(--text-strong); }
#star-button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linejoin: round; }
#star-button.on { color: #ffc83d; }
#star-button.on svg { fill: #ffc83d; stroke: #ffc83d; }
#star-button .count:empty { display: none; }

.star-panel {
  position: fixed;
  z-index: 12;
  width: 300px;
  max-height: min(520px, calc(100vh - 60px));
  overflow-y: auto;
  padding: 10px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-l, 10px);
  background: var(--panel);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  font-size: 12px;
}
.star-head { display: flex; gap: 6px; align-items: baseline; margin: 0 2px 8px; color: var(--text-strong); }
.star-head span { opacity: 0.6; }
.star-actions { display: flex; gap: 6px; margin-bottom: 10px; }
.star-actions button {
  flex: 1;
  padding: 5px 8px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius, 6px);
  background: var(--card);
  color: var(--text-strong);
  font: inherit;
  cursor: pointer;
}
.star-actions button.on { border-color: #ffc83d; color: #ffc83d; }
.star-actions button:disabled { opacity: 0.5; cursor: default; }
.star-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.star-thumb {
  position: relative;
  aspect-ratio: 1;
  border: 0;
  border-radius: var(--radius, 6px);
  background: var(--card) center / cover no-repeat;
  cursor: pointer;
  overflow: hidden;
}
.star-thumb:hover { outline: 2px solid var(--accent); }
.star-thumb[data-caption]::after {
  content: attr(data-caption);
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 2px 4px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}
.star-empty { margin: 4px 2px; line-height: 1.5; }

/* ---------- Captions ---------- */

.caption-editor {
  position: fixed;
  z-index: 15;
  box-sizing: border-box;
  min-height: 1.6em;
  margin: 0;
  padding: 0 2px;
  border: 1px solid var(--accent);
  border-radius: 3px;
  background: var(--input);
  color: var(--text-strong);
  font-family: Inter, system-ui, sans-serif;
  line-height: 1.3;
  resize: none;
  overflow: hidden;
  outline: none;
  transform-origin: top left;
}

/* ---------- Compare ---------- */

.compare {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  background: #111113;
  color: #c8c8cc;
  font-size: 12px;
}
.compare-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 10px;
  border-bottom: 1px solid #26262b;
}
.compare-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compare-name[data-n="b"] { text-align: right; }
.compare-modes { display: flex; padding: 2px; border-radius: 8px; background: #1e1e22; }
.compare-bar button {
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.compare-bar button:hover { background: rgba(255, 255, 255, 0.08); }
.compare-bar button.on { background: #4da3ff; color: #fff; }
.compare-close { display: grid; place-items: center; width: 32px; padding: 0 !important; }
.compare-close svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.compare-opacity { display: flex; align-items: center; gap: 6px; }
.compare-opacity[hidden] { display: none; }
.compare-stage { position: relative; flex: 1; overflow: hidden; cursor: grab; touch-action: none; }
.compare[data-mode="slider"] .compare-stage { cursor: ew-resize; }
.compare-view { position: absolute; inset: 0; transform-origin: 0 0; isolation: isolate; }
.compare-box { position: absolute; }
.compare-box img { width: 100%; height: 100%; object-fit: contain; display: block; user-select: none; }
.compare[data-mode="difference"] [data-box="b"] { mix-blend-mode: difference; }
.compare-handle { position: absolute; top: 0; bottom: 0; width: 0; pointer-events: none; display: none; }
.compare[data-mode="slider"] .compare-handle { display: block; }
.compare-handle::before { content: ""; position: absolute; top: 0; bottom: 0; left: -1px; width: 2px; background: #fff; box-shadow: 0 0 6px rgba(0, 0, 0, 0.6); }
.compare-handle span { position: absolute; top: 50%; left: -14px; width: 28px; height: 28px; margin-top: -14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 6px rgba(0, 0, 0, 0.5); }
.compare-handle span::before { content: "‹ ›"; position: absolute; inset: 0; display: grid; place-items: center; color: #222; font-size: 14px; font-weight: 600; letter-spacing: -1px; }

/* Mood board colours */
.mood-palette { display: flex; align-items: center; gap: 6px; padding: 0 8px 8px; font-size: 12px; }
.mood-palette-label { opacity: 0.7; }
.mood-swatches { display: flex; gap: 4px; }
.mood-swatch {
  position: relative;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(128, 128, 128, 0.35);
  cursor: pointer;
}
.mood-swatch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.mood-swatch-x {
  position: absolute;
  top: -6px;
  right: -6px;
  display: none;
  width: 14px;
  height: 14px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--panel);
  color: var(--text-strong);
  font-size: 11px;
  line-height: 14px;
  cursor: pointer;
}
.mood-swatch:hover .mood-swatch-x { display: block; }
.mood-palette button:not(.mood-swatch-x) {
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: none;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.mood-palette button:not(.mood-swatch-x):hover { color: var(--text-strong); border-color: var(--border-strong); }
.mood-palette button[hidden] { display: none; }
.mood-palette.empty .mood-palette-label { opacity: 0.5; }

/* ---------- Liquid motion ----------
   Things open with a little spring, as if they had some weight and give. All of it is
   switched off with Liquid motion: off (board menu), or reduced motion on the computer. */

:root { --spring: cubic-bezier(0.34, 1.56, 0.64, 1); --soft: cubic-bezier(0.22, 1, 0.36, 1); }
:root { --radius-s: 8px; --radius: 10px; --radius-l: 16px; }

@keyframes liquid-in {
  0% { opacity: 0; transform: scale(0.9, 0.86); }
  60% { opacity: 1; transform: scale(1.015, 1.03); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes liquid-up {
  0% { opacity: 0; transform: translateY(10px) scale(0.94, 0.9); }
  60% { opacity: 1; transform: translateY(-2px) scale(1.02, 1.04); }
  100% { opacity: 1; transform: none; }
}
body[data-motion="on"] .menu,
body[data-motion="on"] .star-panel { transform-origin: top left; animation: liquid-in 0.32s var(--soft) both; }
body[data-motion="on"] .star-panel { transform-origin: top right; }
body[data-motion="on"] #selection-bar:not([hidden]) > * { animation: liquid-up 0.34s var(--soft) both; }
body[data-motion="on"] #present-hud:not([hidden]) { animation: liquid-up 0.4s var(--soft) both; }
body[data-motion="on"] .caption-editor,
body[data-motion="on"] .frame-rename { animation: liquid-in 0.25s var(--soft) both; transform-origin: top left; }

/* Buttons give a little when pressed and spring back. */
body[data-motion="on"] :is(#toolbar button, #selection-bar button, .pane-tools button, #board-bar button, .tab, .text-button, .menu-item, .star-thumb, .board-card) {
  transition: transform 0.35s var(--spring), background-color 0.15s, color 0.15s, opacity 0.2s;
}
body[data-motion="on"] :is(#toolbar button, #selection-bar button, .pane-tools button, #board-bar button, .text-button):active { transform: scale(0.88); transition-duration: 0.08s; }
body[data-motion="on"] :is(#toolbar button, #selection-bar button, .pane-tools button):hover { transform: scale(1.08); }
body[data-motion="on"] .star-thumb:hover, body[data-motion="on"] .board-card:hover { transform: scale(1.025); }
body[data-motion="on"] .tab:active { transform: scale(0.95); }

/* Messages slide up with a bounce. */
body[data-motion="on"] #toast { transition: opacity 0.2s, transform 0.45s var(--spring); }

/* The divider glows like a thin stream of light while you hover or drag it. */
.divider::after { transition: opacity 0.15s, transform 0.35s var(--spring); }
body[data-motion="on"] .divider.row.dragging::after { transform: scaleX(1.8); }
body[data-motion="on"] .divider.col.dragging::after { transform: scaleY(1.8); }
.divider { z-index: 5; }
body[data-motion="on"] #toast:not(.show) { transform: translate(-50%, 14px) scale(0.94); }

/* Where dividers meet: grab the dot to move them all at once */
.junction {
  position: absolute;
  z-index: 6;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border-radius: 50%;
  cursor: move;
  touch-action: none;
}
.junction::after {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.15s, transform 0.4s var(--spring, ease);
}
.junction:hover::after, .junction.dragging::after { opacity: 1; transform: scale(1); }
.junction.dragging::after { transform: scale(1.5); }
#panes.single .junction, body.presenting .junction { display: none; }

/* Submenus: the › row stays highlighted while its submenu is open */
.menu-item.has-sub kbd { opacity: 0.5; font-size: 14px; line-height: 1; }
.menu-item.open:not(:disabled) { background: rgba(128, 128, 128, 0.18); }

/* ---------- Google Drive status (home screen and top bar) ---------- */

.drive-status { display: flex; align-items: center; gap: 6px; cursor: pointer; }
#drive-button { height: 26px; padding: 0 7px; border: 0; border-radius: 5px; background: none; color: inherit; }
#drive-button:hover { background: rgba(128, 128, 128, 0.12); color: var(--text-strong); }
.drive-status svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.drive-status .tick { opacity: 0; }
.drive-status[data-state="off"] svg { opacity: 0.55; }
.drive-status[data-state="synced"] .tick, .drive-status[data-state="idle"] .tick { opacity: 1; }
.drive-status[data-state="synced"] { color: #3fb37f; }
.drive-status[data-state="syncing"] svg { animation: drive-pulse 1s ease-in-out infinite; color: var(--accent); }
.drive-status[data-state="reconnect"], .drive-status[data-state="error"] { color: #e0a040; }
@keyframes drive-pulse { 50% { opacity: 0.35; } }
.add-link { display: none; text-decoration: none; }
@media (max-width: 700px) { .add-link { display: inline-flex; align-items: center; } }

/* ---------- The phone page (#/add) ---------- */

#add-page { display: none; }
body[data-mode="add"] #home,
body[data-mode="add"] #stage,
body[data-mode="add"] #panes,
body[data-mode="add"] #board-bar,
body[data-mode="add"] #empty-hint,
body[data-mode="add"] #toolbar,
body[data-mode="add"] #selection-bar,
body[data-mode="add"] #brush-cursor { display: none !important; }
body[data-mode="add"] { overflow: auto; background: var(--bg); }
body[data-mode="add"] #add-page {
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-sizing: border-box;
  max-width: 520px;
  min-height: 100%;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  font-size: 15px;
}
.add-head { display: flex; justify-content: space-between; align-items: center; opacity: 0.7; font-size: 13px; }
.add-back { color: var(--accent); text-decoration: none; }
#add-page h1 { margin: 6px 0 4px; font-size: 22px; color: var(--text-strong); }
#add-page h2 { margin: 8px 0 0; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.6; }
#add-page button { font: inherit; cursor: pointer; }
.add-pick, .add-send, .add-connect {
  min-height: 52px;
  border: 0;
  border-radius: var(--radius-l, 16px);
  font-weight: 600 !important;
}
.add-pick { background: var(--card); color: var(--text-strong); border: 1px dashed var(--border-strong) !important; }
.add-connect { background: #fff; color: #1f1f22; }
.add-connect[hidden] { display: none; }
.add-send { background: var(--accent); color: #fff; }
.add-send:disabled { opacity: 0.45; cursor: default; }
.add-picked { display: flex; flex-direction: column; gap: 8px; }
.add-count { font-size: 13px; opacity: 0.7; }
.add-count:empty { display: none; }
.add-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6px; }
.add-thumbs img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.add-boards { display: flex; flex-wrap: wrap; gap: 8px; }
.add-board {
  padding: 10px 14px;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: var(--card);
  color: var(--text-strong);
}
.add-board.on { border-color: var(--accent); background: var(--accent); color: #fff; }
.add-status { min-height: 1.4em; margin: 0; color: var(--text-strong); }
.add-help, .add-empty { margin: 8px 0 0; font-size: 13px; line-height: 1.5; opacity: 0.65; }
/* Longer notes in a menu (e.g. what went wrong with Drive) wrap instead of stretching it */
.menu-item:disabled span { max-width: 300px; white-space: normal; line-height: 1.4; }

/* A floating copy of what you're dragging into another board's pane */
.drag-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 25;
  width: 120px;
  height: 90px;
  border-radius: 10px;
  background: var(--card) center / cover no-repeat;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45), 0 0 0 2px var(--accent);
  pointer-events: none;
  transition: transform 0.07s linear;
}
@keyframes ghost-in { 0% { scale: 0.5; opacity: 0; } 60% { scale: 1.08; opacity: 1; } 100% { scale: 1; } }
body[data-motion="on"] .drag-ghost { animation: ghost-in 0.35s var(--soft) both; }
.drag-ghost[data-count]::after {
  content: attr(data-count);
  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 11px;
  background: var(--accent);
  color: #fff;
  font: 600 12px/22px Inter, system-ui, sans-serif;
  text-align: center;
}

/* ---------- Colour mode and help buttons in the top bar ---------- */

#bar-alien-button, #help-button, #alien-button { display: grid; place-items: center; }
#bar-alien-button, #help-button {
  height: 26px;
  padding: 0 7px;
  border: 0;
  border-radius: 5px;
  background: none;
  color: inherit;
  cursor: pointer;
}
#bar-alien-button:hover, #help-button:hover { background: rgba(128, 128, 128, 0.14); color: var(--text-strong); }
:is(#bar-alien-button, #alien-button, #help-button) svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linejoin: round; stroke-linecap: round; }
:is(#bar-alien-button, #alien-button) .eye { fill: currentColor; stroke: none; }
body[data-theme="pastel"] :is(#bar-alien-button, #alien-button) { color: var(--accent); }
body[data-motion="on"] :is(#bar-alien-button, #alien-button):hover svg { animation: alien-wobble 0.6s var(--soft); }
@keyframes alien-wobble { 30% { transform: rotate(-12deg) scale(1.1); } 60% { transform: rotate(9deg); } }

/* ---------- Shortcuts and help ---------- */

#help-panel {
  position: fixed;
  inset: 0;
  z-index: 28;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.35);
}
#help-panel[hidden] { display: none; }
.help-box {
  width: min(860px, 100%);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  box-sizing: border-box;
  padding: 18px 20px 14px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-l, 16px);
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  font-size: 12.5px;
}
body[data-motion="on"] #help-panel:not([hidden]) .help-box { animation: liquid-in 0.35s var(--soft) both; transform-origin: top right; }
.help-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; color: var(--text-strong); font-size: 15px; }
.help-close { width: 28px; height: 28px; border: 0; border-radius: 8px; background: none; color: inherit; font-size: 20px; line-height: 1; cursor: pointer; }
.help-close:hover { background: rgba(128, 128, 128, 0.15); }
.help-cols { columns: 260px 3; column-gap: 28px; }
.help-cols section { break-inside: avoid; margin-bottom: 14px; }
.help-cols h3 { margin: 0 0 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent); }
.help-row { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border-bottom: 1px solid var(--line); }
.help-row span { color: var(--text-strong); }
.help-row kbd { border: 0; padding: 0; font: inherit; text-align: right; opacity: 0.75; }
.help-foot { margin: 4px 0 0; opacity: 0.7; }

/* The look button shows what it switches to next: sun (light), alien (colour), moon (dark) */
.theme-cycle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; display: none; }
.theme-cycle .eye { fill: currentColor; stroke: none; }
.theme-cycle[data-next="light"] .icon-sun,
.theme-cycle[data-next="colour"] .icon-colour,
.theme-cycle[data-next="dark"] .icon-moon { display: block; }
body[data-motion="on"] .theme-cycle:hover svg { animation: alien-wobble 0.6s var(--soft); }

/* "Getting your boards from Drive… 2 of 6" above the boards while they download */
.drive-progress { margin: -6px 0 14px; color: var(--accent); font-size: 13px; }
.drive-progress[hidden] { display: none; }
body[data-motion="on"] .drive-progress::before { content: "●"; margin-right: 8px; animation: drive-pulse 1s ease-in-out infinite; }
