/* ============================================================
   Inkdesk — minimal black-and-white digital sketchbook
   ============================================================ */

/* Handwriting faces, self-hosted so the board still works offline and an
   export renders the same everywhere. Latin subsets from Google Fonts,
   all under the SIL Open Font License. */
@font-face {
  font-family: 'Finger Paint';
  src: url('../fonts/fingerpaint.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Caveat';
  src: url('../fonts/caveat.woff2') format('woff2');
  font-weight: 400 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Patrick Hand';
  src: url('../fonts/patrickhand.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}

:root {
  --ink:        #14130f;
  --ink-soft:   #3d3b35;
  --muted:      #8b877e;
  --faint:      #b6b2a9;
  --paper:      #ffffff;
  --shell:      #faf9f6;
  --line:       #e6e3db;
  --line-soft:  #efece5;
  --hair:       rgba(20, 19, 15, 0.10);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;

  --sh-1: 0 1px 2px rgba(20,19,15,.05), 0 2px 8px rgba(20,19,15,.05);
  --sh-2: 0 2px 4px rgba(20,19,15,.06), 0 8px 24px rgba(20,19,15,.08);
  --sh-3: 0 8px 40px rgba(20,19,15,.14);

  --ui: 13px;
  --font: ui-sans-serif, -apple-system, "Segoe UI Variable Text", "Segoe UI",
          Inter, Roboto, system-ui, sans-serif;

  --ease: cubic-bezier(.22,.68,.36,1);
  --sb-w: 244px;
}

* { box-sizing: border-box; }

/* An author `display` rule outranks the UA rule for [hidden], which would
   leave full-screen overlays (modal-root) invisible but still swallowing
   every pointer event. Make the attribute win, always. */
[hidden] { display: none !important; }

html, body {
  margin: 0; height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--shell);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { touch-action: none; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
::selection { background: var(--ink); color: var(--paper); }

svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.app { position: fixed; inset: 0; }
.view { position: absolute; inset: 0; }
.app[data-view="home"]  #view-board { display: none; }
.app[data-view="board"] #view-home  { display: none; }

/* ============================ buttons ============================ */

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 36px; padding: 0 15px;
  border: 1px solid var(--ink); border-radius: 999px;
  background: var(--paper); color: var(--ink);
  font-weight: 500; font-size: 13px; white-space: nowrap;
  transition: transform .13s var(--ease), background .13s, color .13s, box-shadow .13s;
}
.btn svg { width: 15px; height: 15px; stroke-width: 2; }
.btn:hover { transform: translateY(-1.5px); box-shadow: var(--sh-1); }
.btn:active { transform: translateY(0) scale(.975); }
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: #000; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--ink); border-color: var(--line); background: var(--paper); }
.btn-danger:hover { background: var(--ink); color: var(--paper); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 10px; color: var(--ink-soft);
  position: relative;
  transition: transform .13s var(--ease), background .13s, color .13s;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.sm { width: 28px; height: 28px; border-radius: 8px; }
.icon-btn.sm svg { width: 15px; height: 15px; }
.icon-btn:hover { background: var(--shell); color: var(--ink); transform: translateY(-1px); }
.icon-btn:active { transform: translateY(0) scale(.92); }
.icon-btn[disabled] { opacity: .28; pointer-events: none; }
.icon-btn.on { background: var(--ink); color: var(--paper); }

/* tooltips */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 9px); left: 50%;
  transform: translateX(-50%) translateY(3px);
  background: var(--ink); color: var(--paper);
  font-size: 11px; font-weight: 500; letter-spacing: .01em;
  padding: 5px 8px; border-radius: 7px; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity .12s .25s, transform .12s .25s var(--ease);
  z-index: 60;
}
[data-tip]:hover::after { opacity: 1; transform: translateX(-50%) translateY(0); }
.tip-below[data-tip]::after { bottom: auto; top: calc(100% + 9px); }

/* ============================== home ============================== */

.view-home { overflow-y: auto; background: var(--paper); }
.home-inner { max-width: 1100px; margin: 0 auto; padding: 34px 40px 100px; }

.home-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: flex; align-items: center; gap: 9px; }
.brand-mark { width: 26px; height: 26px; }
.brand-mark rect { fill: var(--ink); stroke: none; }
.brand-mark path { stroke: var(--paper); stroke-width: 2.4; }
.brand-name { font-weight: 600; letter-spacing: -.01em; font-size: 15px; }

.home-search { position: relative; width: 280px; max-width: 40vw; }
.home-search svg { position: absolute; left: 11px; top: 50%; margin-top: -7.5px; width: 15px; height: 15px; color: var(--faint); }
.home-search input, .sb-search input {
  width: 100%; height: 34px; padding: 0 12px 0 32px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--paper);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.home-search input:focus, .sb-search input:focus { border-color: var(--ink); }
input[type=search]::-webkit-search-cancel-button { -webkit-appearance: none; }

.home-title { font-size: 42px; letter-spacing: -.035em; font-weight: 600; margin: 56px 0 6px; }
.home-sub { color: var(--muted); margin: 0 0 26px; font-size: 14px; }
.home-actions { display: flex; gap: 10px; margin-bottom: 34px; }

.home-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(216px, 1fr));
}

.nb-card {
  position: relative; text-align: left;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--paper); padding: 16px 16px 14px; min-height: 132px;
  display: flex; flex-direction: column; gap: 3px;
  transition: transform .16s var(--ease), box-shadow .16s, border-color .16s;
  animation: card-in .28s var(--ease) both;
}
@keyframes card-in { from { opacity: 0; transform: translateY(8px) scale(.985); } }
.nb-card:hover { transform: translateY(-3px); border-color: var(--ink); box-shadow: var(--sh-2); }
.nb-card:active { transform: translateY(-1px) scale(.995); }
.nb-icon { font-size: 24px; line-height: 1.1; margin-bottom: 10px; }
.nb-name { font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.nb-meta { color: var(--muted); font-size: 12px; }
.nb-card .card-menu {
  position: absolute; top: 10px; right: 10px; opacity: 0;
  transition: opacity .14s;
}
.nb-card:hover .card-menu { opacity: 1; }

.nb-card.add {
  align-items: center; justify-content: center; color: var(--muted);
  border-style: dashed; gap: 8px; flex-direction: row; font-weight: 500;
}
.nb-card.add:hover { color: var(--ink); }
.nb-card.add svg { width: 16px; height: 16px; }

.home-empty { color: var(--muted); padding: 40px 0; }
.home-results { margin-top: 8px; }
.res-group { margin-bottom: 22px; }
.res-h { font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); margin-bottom: 8px; }
.res-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 12px; border-radius: 10px; text-align: left;
  transition: background .12s;
}
.res-item:hover { background: var(--shell); }
.res-item .ri-sub { color: var(--muted); margin-left: auto; font-size: 12px; }

/* ============================= board ============================= */

.view-board { background: var(--shell); }
.canvas-wrap { position: absolute; inset: 0; overflow: hidden; }
.c-scene, .c-overlay { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.c-overlay { pointer-events: none; }
.dom-layer { position: absolute; inset: 0; pointer-events: none; }

/* text editing overlay */
.text-edit {
  position: absolute; pointer-events: auto;
  border: 0; outline: 0; resize: none; overflow: hidden;
  background: transparent; padding: 0; margin: 0;
  white-space: pre; line-height: 1.25;
  transform-origin: 0 0;
  caret-color: var(--ink);
  font-family: var(--font);
}

.empty-hint {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  text-align: center; pointer-events: none; user-select: none;
  animation: fade-in .5s .15s var(--ease) both;
}
@keyframes fade-in { from { opacity: 0; transform: translate(-50%, calc(-50% + 6px)); } }
.empty-hint .eh-1 { font-size: 19px; font-weight: 500; margin: 0 0 2px; color: var(--ink-soft); }
.empty-hint .eh-2 { font-size: 19px; margin: 0 0 16px; color: var(--faint); }
.empty-hint .btn { pointer-events: auto; }

/* ---- floating chrome ---- */

.topleft, .topright, .toolbar, .zoomctl, .tool-options, .sidebar, .minimap, .sb-toggle {
  position: absolute; z-index: 20;
}
.topleft {
  top: 14px; left: 14px; display: flex; align-items: center; gap: 6px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  padding: 5px 10px 5px 5px; box-shadow: var(--sh-1); max-width: 46vw;
}
.app[data-sidebar="open"] .topleft { left: calc(var(--sb-w) + 22px); }
.crumb { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13px; }
.crumb-nb { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.crumb-sep { color: var(--faint); }
.crumb-pg {
  font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 220px; cursor: text; padding: 2px 4px; margin: -2px -4px; border-radius: 5px;
}
.crumb-pg:hover { background: var(--shell); }
.crumb-pg[contenteditable="true"] { background: var(--shell); outline: 1px solid var(--ink); }

.save-status {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--faint); font-size: 11px; margin-left: 4px; white-space: nowrap;
}
.save-status i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.save-status[data-state="saving"] { color: var(--muted); }
.save-status[data-state="saving"] i { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .25; } }

.topright {
  top: 14px; right: 14px; display: flex; align-items: center; gap: 2px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  padding: 4px; box-shadow: var(--sh-1);
}
.tr-sep { width: 1px; height: 18px; background: var(--line); margin: 0 4px; }

/* ---- toolbar (the pencil case) ---- */

.toolbar {
  bottom: 20px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 2px;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 5px; box-shadow: var(--sh-2);
}
.toolbar .sep { width: 1px; height: 22px; background: var(--line); margin: 0 5px; }
.tool {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 11px; color: var(--ink-soft);
  position: relative;
  transition: transform .14s var(--ease), background .14s, color .14s;
}
.tool svg { width: 19px; height: 19px; }
.tool:hover { background: var(--shell); color: var(--ink); transform: translateY(-2px); }
.tool:active { transform: translateY(0) scale(.9); }
.tool.on { background: var(--ink); color: var(--paper); }
.tool.on:hover { transform: translateY(-2px); background: #000; }
.tool.bounce { animation: bounce .34s var(--ease); }
@keyframes bounce {
  0% { transform: translateY(0) scale(1); }
  35% { transform: translateY(-5px) scale(1.06); }
  65% { transform: translateY(1px) scale(.97); }
  100% { transform: translateY(0) scale(1); }
}
.tool .swatch-dot {
  position: absolute; bottom: 4px; right: 4px;
  width: 7px; height: 7px; border-radius: 50%;
  box-shadow: 0 0 0 1.5px var(--paper);
}
.tool.on .swatch-dot { box-shadow: 0 0 0 1.5px var(--ink); }

.tool-add-pen {
  width: 24px; height: 38px; border-radius: 8px;
  color: var(--muted); opacity: 0.65;
  margin: 0 1px;
}
.tool-add-pen svg { width: 13px; height: 13px; stroke-width: 2.2; }
.tool-add-pen:hover {
  background: var(--shell); color: var(--ink);
  opacity: 1; transform: translateY(-1.5px);
}
.tool-add-pen:active { transform: translateY(0) scale(.92); }

/* toolbar pinned to the top instead */
.app[data-toolbar="top"] .toolbar { top: 62px; bottom: auto; }
.app[data-toolbar="top"] .tool-options { top: 116px; bottom: auto; }
.app[data-toolbar="top"] .toolbar [data-tip]::after,
.app[data-toolbar="top"] .tool-options [data-tip]::after { bottom: auto; top: calc(100% + 9px); }
.app[data-toolbar="top"] .empty-hint { transform: translate(-50%, -35%); }

/* ---- contextual tool options ---- */

.tool-options {
  bottom: 76px; left: 50%; transform: translateX(-50%);
  width: 250px; padding: 13px 14px 14px;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--sh-2);
  animation: opt-in .18s var(--ease) both;
  will-change: transform, opacity;
  /* The formats list is far taller than a pen's options, so the panel scrolls
     rather than running off the top of the screen. */
  max-height: calc(100vh - 150px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.tool-options::-webkit-scrollbar { width: 8px; }
.tool-options::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.tool-options::-webkit-scrollbar-track { background: transparent; }
@keyframes opt-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.tool-options.closing {
  animation: opt-out .14s var(--ease) forwards;
  pointer-events: none;
}
@keyframes opt-out {
  from { opacity: 1; transform: translateX(-50%) translateY(0); }
  to { opacity: 0; transform: translateX(-50%) translateY(8px); }
}

.app[data-toolbar="top"] .tool-options.closing {
  animation: opt-out-top .14s var(--ease) forwards;
}
@keyframes opt-out-top {
  from { opacity: 1; transform: translateX(-50%) translateY(0); }
  to { opacity: 0; transform: translateX(-50%) translateY(-8px); }
}

.opt-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.opt-title { font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); margin-bottom: 0; }
.opt-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}
.opt-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  transition: background .12s, color .12s;
}
.opt-btn-icon svg { width: 13px; height: 13px; stroke-width: 2; }
.opt-btn-icon:hover { background: var(--shell); color: var(--ink); }
.opt-btn-danger:hover { background: rgba(214, 69, 61, 0.12); color: #d6453d; }
.opt-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  transition: background .12s, color .12s;
}
.opt-close svg { width: 13px; height: 13px; stroke-width: 2; }
.opt-close:hover { background: var(--shell); color: var(--ink); }
.opt-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.opt-row:last-child { margin-bottom: 0; }
.opt-label { width: 52px; color: var(--muted); flex: none; font-size: 12px; }
.opt-val { width: 34px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }

input[type=range] {
  -webkit-appearance: none; appearance: none;
  flex: 1; height: 18px; background: transparent; outline: none; margin: 0;
}
input[type=range]::-webkit-slider-runnable-track { height: 2px; background: var(--line); border-radius: 2px; }
input[type=range]::-moz-range-track { height: 2px; background: var(--line); border-radius: 2px; }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%;
  background: var(--ink); margin-top: -5.5px; border: 0;
  transition: transform .12s var(--ease);
}
input[type=range]::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: var(--ink); border: 0; }
input[type=range]:active::-webkit-slider-thumb { transform: scale(1.25); }

.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch {
  width: 21px; height: 21px; border-radius: 6px; position: relative;
  box-shadow: inset 0 0 0 1px var(--hair);
  transition: transform .12s var(--ease);
}
.swatch:hover { transform: scale(1.14); }
.swatch:active { transform: scale(.94); }
.swatch.on { box-shadow: inset 0 0 0 1px var(--hair), 0 0 0 2px var(--paper), 0 0 0 3.5px var(--ink); }
.swatch.custom {
  display: grid; place-items: center; color: var(--muted);
  background: var(--paper); overflow: hidden;
}
.swatch.custom svg { width: 13px; height: 13px; }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.swatch.none { background: var(--paper); }
.swatch.none::after {
  content: ''; position: absolute; inset: 0; border-radius: 6px;
  background: linear-gradient(to bottom right, transparent 44%, #d64545 44%, #d64545 56%, transparent 56%);
}
.opt-sub { font-size: 11px; color: var(--faint); margin: 12px 0 7px; letter-spacing: .06em; text-transform: uppercase; }

.seg { display: flex; gap: 3px; background: var(--shell); border-radius: 9px; padding: 3px; flex: 1; }
.seg button {
  flex: 1; height: 26px; border-radius: 7px; color: var(--muted); font-size: 12px;
  display: grid; place-items: center; transition: background .12s, color .12s;
}
.seg button svg { width: 15px; height: 15px; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--paper); color: var(--ink); box-shadow: var(--sh-1); }

.shape-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.shape-grid button {
  height: 40px; border-radius: 9px; display: grid; place-items: center; color: var(--ink-soft);
  transition: background .12s, transform .12s var(--ease);
}
.shape-grid button svg { width: 20px; height: 20px; }
.shape-grid button:hover { background: var(--shell); transform: translateY(-1px); }
.shape-grid button.on { background: var(--ink); color: var(--paper); }

/* ---- font picker ---- */

.font-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.font-grid button {
  height: 40px; padding: 0 4px; border-radius: 9px;
  display: grid; place-items: center; color: var(--ink-soft);
  border: 1px solid var(--line-soft);
  font-size: 14px; line-height: 1.1; text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: background .12s, color .12s, border-color .12s, transform .12s var(--ease);
}
.font-grid button:hover { background: var(--shell); color: var(--ink); transform: translateY(-1px); }
.font-grid button.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ---- zoom ---- */

.zoomctl {
  bottom: 20px; right: 20px; display: flex; align-items: center; gap: 2px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  padding: 4px; box-shadow: var(--sh-1);
}
.zoom-label {
  min-width: 52px; height: 28px; border-radius: 8px; color: var(--ink);
  font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 500;
  transition: background .12s;
}
.zoom-label:hover { background: var(--shell); }

.minimap {
  bottom: 68px; right: 20px; width: 200px; height: 140px;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--sh-1); overflow: hidden;
}
.minimap canvas { width: 100%; height: 100%; display: block; cursor: pointer; }

/* ---- sidebar ---- */

.sidebar {
  top: 0; bottom: 0; left: 0; width: var(--sb-w);
  background: var(--paper); border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  transform: translateX(-100%);
  transition: transform .22s var(--ease);
  z-index: 30;
}
.app[data-sidebar="open"] .sidebar { transform: none; }
.sb-toggle {
  top: 14px; left: 14px; width: 34px; height: 34px; border-radius: 10px;
  background: var(--paper); border: 1px solid var(--line); box-shadow: var(--sh-1);
  display: grid; place-items: center; color: var(--ink-soft); z-index: 31;
  transition: transform .16s var(--ease), left .22s var(--ease), top .22s var(--ease);
}
.sb-toggle svg { width: 17px; height: 17px; }
.sb-toggle:hover { transform: translateY(-1px); color: var(--ink); }

/* Open, the toggle moves into the sidebar's header, keeping the far-right
   slot it was designed for. The new-notebook button is what has to move: it
   steps aside to the left rather than sitting underneath. The 3px drop puts
   the two on a shared centre line. */
.app[data-sidebar="open"] .sb-toggle {
  top: 11px;
  left: calc(var(--sb-w) - 44px);
  border-color: transparent; box-shadow: none; background: transparent;
}
.app[data-sidebar="open"] .sb-toggle:hover { background: var(--shell); }

.sb-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 10px 8px 16px; }
.app[data-sidebar="open"] #sb-new-notebook { margin-right: 40px; }
.sb-title {
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--faint); font-weight: 600;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sb-search { position: relative; padding: 0 12px 10px; }
.sb-search svg { position: absolute; left: 23px; top: 9px; width: 14px; height: 14px; color: var(--faint); }
.sb-search input { height: 30px; }

.sb-tree { flex: 1; overflow-y: auto; padding: 2px 8px 16px; scrollbar-width: thin; }
.sb-tree::-webkit-scrollbar { width: 8px; }
.sb-tree::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; border: 2px solid var(--paper); }

.nb-row, .pg-row {
  display: flex; align-items: center; gap: 6px; width: 100%;
  padding: 6px 6px; border-radius: 8px; text-align: left;
  transition: background .1s;
  position: relative;
}
.nb-row { font-weight: 500; margin-top: 2px; }
.nb-row:hover, .pg-row:hover { background: var(--shell); }
.nb-row.drop-into { background: var(--shell); box-shadow: inset 0 0 0 1px var(--ink); }
.nb-caret { width: 14px; height: 14px; color: var(--faint); flex: none; transition: transform .16s var(--ease); }
.nb-row.collapsed .nb-caret { transform: rotate(-90deg); }
.nb-emoji { font-size: 14px; flex: none; }
.nb-label, .pg-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-count { color: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; }
.row-menu { opacity: 0; transition: opacity .12s; flex: none; }
.nb-row:hover .row-menu, .pg-row:hover .row-menu { opacity: 1; }

.pg-list { padding-left: 10px; margin-left: 11px; border-left: 1px solid var(--line-soft); }
.pg-row { color: var(--ink-soft); font-size: 12.5px; padding-left: 8px; }
.pg-row.on { background: var(--ink); color: var(--paper); }
.pg-row.on .nb-count, .pg-row.on .row-menu { color: var(--paper); }
.pg-thumb {
  width: 26px; height: 19px; border-radius: 3px; flex: none;
  background: var(--paper) center/cover no-repeat;
  box-shadow: inset 0 0 0 1px var(--hair);
}
.pg-row.on .pg-thumb { box-shadow: inset 0 0 0 1px rgba(255,255,255,.35); }
.pg-add {
  display: flex; align-items: center; gap: 6px; width: 100%;
  padding: 5px 8px; border-radius: 8px; color: var(--faint); font-size: 12.5px;
  transition: background .1s, color .1s;
}
.pg-add svg { width: 13px; height: 13px; }
.pg-add:hover { background: var(--shell); color: var(--ink); }

.drag-over-top { box-shadow: inset 0 2px 0 -1px var(--ink); }
.drag-over-bottom { box-shadow: inset 0 -2px 0 -1px var(--ink); }
.dragging { opacity: .4; }

.sb-foot { border-top: 1px solid var(--line); padding: 8px; }
.sb-foot-btn {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 8px; border-radius: 8px; color: var(--muted);
  transition: background .1s, color .1s;
}
.sb-foot-btn svg { width: 15px; height: 15px; }
.sb-foot-btn:hover { background: var(--shell); color: var(--ink); }

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

.menu-root { position: fixed; inset: 0; z-index: 200; }
.menu {
  position: absolute; min-width: 190px; padding: 5px;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--sh-3);
  animation: menu-in .12s var(--ease) both;
}
@keyframes menu-in { from { opacity: 0; transform: scale(.97) translateY(-3px); } }
.menu-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 7px 9px; border-radius: 8px; text-align: left; color: var(--ink);
  transition: background .1s;
}
.menu-item svg { width: 15px; height: 15px; color: var(--muted); flex: none; }
.menu-item:hover { background: var(--shell); }
.menu-item[disabled] { opacity: .32; pointer-events: none; }
.menu-item .mk { margin-left: auto; color: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; }
.menu-sep { height: 1px; background: var(--line); margin: 5px 7px; }
.menu-head { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 7px 9px 4px; }
.menu-emoji { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; padding: 3px; }
.menu-emoji button { width: 26px; height: 26px; border-radius: 7px; font-size: 15px; transition: background .1s, transform .1s var(--ease); }
.menu-emoji button:hover { background: var(--shell); transform: scale(1.15); }

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

.modal-root { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; }
.modal-back { position: absolute; inset: 0; background: rgba(20,19,15,.22); animation: fade .16s both; }
@keyframes fade { from { opacity: 0; } }
.modal {
  position: relative; background: var(--paper); border-radius: var(--r-lg);
  box-shadow: var(--sh-3); width: min(560px, calc(100vw - 40px));
  max-height: calc(100vh - 60px); display: flex; flex-direction: column;
  animation: modal-in .2s var(--ease) both;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--line);
}
.modal-title { font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--line); }
.modal.sm { width: min(400px, calc(100vw - 40px)); }
.modal.auth-modal {
  position: fixed;
  inset: 0;
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  border: none !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden;
}
.modal.auth-modal > .modal-head { display: none; }
.modal.auth-modal > .modal-body { padding: 0; overflow: hidden; width: 100vw; height: 100vh; }

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field label { display: block; color: var(--muted); margin-bottom: 6px; font-size: 12px; }
.field input[type=text], .field input[type=number], .field input[type=password],
.field input[type=email], .field select {
  width: 100%; height: 36px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--paper); outline: none;
  transition: border-color .14s;
}
.field input:focus, .field select:focus { border-color: var(--ink); }

.set-sec { margin-bottom: 26px; }
.set-sec:last-child { margin-bottom: 0; }
.set-h { font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); margin-bottom: 12px; padding-bottom: 7px; border-bottom: 1px solid var(--line-soft); }
.set-row { display: flex; align-items: center; gap: 12px; min-height: 34px; margin-bottom: 8px; }
.set-row .sr-label { flex: 1; }
.set-row .sr-hint { color: var(--faint); font-size: 11.5px; margin-top: 1px; }
.set-ctl { width: 150px; flex: none; display: flex; align-items: center; gap: 8px; justify-content: flex-end; }

.switch { width: 38px; height: 22px; border-radius: 999px; background: var(--line); position: relative; transition: background .16s; flex: none; }
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--paper); box-shadow: var(--sh-1);
  transition: transform .18s var(--ease);
}
.switch.on { background: var(--ink); }
.switch.on::after { transform: translateX(16px); }

.kbd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 24px; }
.kbd-row { display: flex; align-items: center; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid var(--line-soft); }
.kbd-row span { color: var(--ink-soft); }
kbd {
  font-family: var(--font); font-size: 11px; font-weight: 500;
  background: var(--shell); border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 5px; padding: 2px 6px; color: var(--ink-soft); white-space: nowrap;
}

.storage-bar { height: 6px; border-radius: 3px; background: var(--line-soft); overflow: hidden; margin-top: 8px; }
.storage-bar i { display: block; height: 100%; background: var(--ink); border-radius: 3px; transition: width .3s var(--ease); }

.export-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.export-grid button {
  border: 1px solid var(--line); border-radius: 11px; padding: 14px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  color: var(--ink-soft); font-weight: 500;
  transition: transform .14s var(--ease), border-color .14s, box-shadow .14s;
}
.export-grid button svg { width: 20px; height: 20px; }
.export-grid button:hover { transform: translateY(-2px); border-color: var(--ink); box-shadow: var(--sh-1); }

/* ---- onboarding ---- */

.onboard {
  text-align: center; padding: 34px 30px 28px;
}
.onboard h2 { font-size: 24px; letter-spacing: -.03em; margin: 0 0 8px; font-weight: 600; }
.onboard p { color: var(--muted); margin: 0 0 22px; line-height: 1.55; }
.onboard-mark { width: 46px; height: 46px; margin: 0 auto 18px; display: block; }
.onboard-mark rect { fill: var(--ink); stroke: none; }
.onboard-mark path { stroke: var(--paper); stroke-width: 2.4; stroke-dasharray: 46; animation: draw 1s .2s var(--ease) both; }
@keyframes draw { from { stroke-dashoffset: 46; } to { stroke-dashoffset: 0; } }

/* ---- toast ---- */

.toast-root {
  position: fixed; bottom: 74px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  z-index: 400; pointer-events: none;
}
.toast {
  background: var(--ink); color: var(--paper); font-size: 12.5px; font-weight: 500;
  padding: 9px 14px; border-radius: 999px; box-shadow: var(--sh-2);
  animation: toast-in .22s var(--ease) both;
}
.toast.out { animation: toast-out .2s var(--ease) both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-6px); } }

/* ---- school accounts: class rows and cards ---- */

.cls-row { font-weight: 600; }
.cls-children { padding-left: 10px; border-left: 1px solid var(--line-soft); margin-left: 12px; }
.nb-teacher { display: block; font-size: 10.5px; color: var(--faint); font-weight: 400; line-height: 1.3; }
.nb-row .nb-label { display: block; min-width: 0; }

.crumb-back-card {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 132px; border-radius: var(--r-lg);
  border: 1px dashed var(--line); background: transparent; color: var(--muted);
  font-weight: 500;
  transition: color .14s, border-color .14s, transform .14s var(--ease);
}
.crumb-back-card svg { width: 15px; height: 15px; }
.crumb-back-card:hover { color: var(--ink); border-color: var(--ink); transform: translateY(-2px); }

/* ---- account choice on first run ---- */

.acct-choice { display: flex; flex-direction: column; gap: 8px; width: 100%; margin: 4px 0 18px; }
.acct-opt {
  display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 13px 14px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--paper);
  transition: border-color .14s, background .14s, transform .14s var(--ease);
}
.acct-opt:hover { border-color: var(--ink); transform: translateY(-1px); }
.acct-opt.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: var(--shell); }
.acct-emoji { font-size: 22px; line-height: 1; flex: none; }
.acct-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.acct-title { font-weight: 600; font-size: 14px; }
.acct-note { font-size: 12px; color: var(--muted); }
.acct-later { margin: 10px 0 0; font-size: 11.5px; color: var(--faint); }

/* ---- formats, tables and charts ---- */

.opt-note { margin: 0 0 10px; font-size: 11.5px; line-height: 1.45; color: var(--muted); }

.fmt-list { display: flex; flex-direction: column; gap: 3px; margin-bottom: 4px; }
.fmt-item {
  display: flex; flex-direction: column; gap: 1px; align-items: flex-start;
  padding: 7px 9px; border-radius: 9px; text-align: left;
  border: 1px solid transparent;
  transition: background .12s, border-color .12s, transform .12s var(--ease);
}
.fmt-item:hover { background: var(--shell); border-color: var(--line); transform: translateX(1px); }
.fmt-name { font-size: 12.5px; font-weight: 500; color: var(--ink); }
.fmt-hint { font-size: 11px; color: var(--faint); }

.row-ops { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-bottom: 8px; }
.row-ops button {
  height: 30px; padding: 0 2px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--paper);
  font-size: 11.5px; color: var(--ink-soft); white-space: nowrap;
  transition: background .12s, color .12s, border-color .12s, transform .12s var(--ease);
}
.row-ops button:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); transform: translateY(-1px); }
.row-ops button:active { transform: translateY(0) scale(.94); }

/* the in-place cell editor sits exactly over its cell */
.cell-edit {
  padding: 0 8px; border: 0; resize: none; overflow: hidden;
  background: #fffbe8; box-shadow: inset 0 0 0 1.5px var(--ink);
  border-radius: 0;
}

.data-editor {
  width: 100%; min-height: 150px; resize: vertical;
  padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--shell); font-family: var(--font); font-size: 13px; line-height: 1.5;
  outline: none;
}
.data-editor:focus { border-color: var(--ink); background: var(--paper); }

/* ---- the chemistry bench ---- */

.lab {
  position: absolute; z-index: 22;
  left: 14px; top: 50%; transform: translateY(-50%);
  width: 288px; max-height: calc(100vh - 120px);
  display: flex; flex-direction: column;
}
.app[data-sidebar="open"] .lab { left: calc(var(--sb-w) + 20px); }

.lab-shelf {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--sh-2);
  padding: 12px 13px 14px;
  overflow-y: auto; overscroll-behavior: contain;
  animation: lab-in .2s var(--ease) both;
}
@keyframes lab-in { from { opacity: 0; transform: translateX(-8px); } }
.lab-shelf::-webkit-scrollbar { width: 8px; }
.lab-shelf::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }

.lab-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.lab-title { font-weight: 600; font-size: 13px; letter-spacing: -.01em; }
.lab-sub {
  font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--faint); margin: 12px 0 6px;
}
.lab-group { font-size: 11px; color: var(--muted); margin: 8px 0 4px; }

.lab-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.lab-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 2px 5px; border-radius: 9px; border: 1px solid transparent;
  color: var(--ink-soft);
  transition: background .12s, border-color .12s, transform .12s var(--ease);
}
.lab-item svg { width: 22px; height: 22px; }
.lab-item:hover { background: var(--shell); border-color: var(--line); transform: translateY(-1px); }
.lab-name { font-size: 8.5px; color: var(--faint); line-height: 1.1; text-align: center; }

.lab-panel {
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 10px 11px; background: var(--shell);
}
.lab-vessel-name { font-weight: 600; font-size: 12.5px; margin-bottom: 6px; }
.lab-empty { font-size: 11.5px; color: var(--faint); padding: 2px 0 4px; }

.lab-contents { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; }
.lab-content-row { display: flex; align-items: center; gap: 7px; font-size: 11.5px; }
.lab-swatch {
  width: 12px; height: 12px; border-radius: 4px; flex: none;
  box-shadow: inset 0 0 0 1px rgba(20,19,15,.14);
}
.lab-cname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lab-cml { color: var(--muted); font-variant-numeric: tabular-nums; }

.lab-readout { display: flex; gap: 6px; margin: 8px 0; }
.lab-stat {
  flex: 1; display: flex; flex-direction: column; gap: 1px;
  padding: 6px 7px; border-radius: 8px; background: var(--paper);
  border: 1px solid var(--line-soft);
}
.lab-stat span { font-size: 9.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; }
.lab-stat b { font-size: 13px; font-variant-numeric: tabular-nums; }

.lab-obs { margin: 6px 0 8px; padding-left: 16px; }
.lab-obs li { font-size: 11.5px; line-height: 1.45; color: var(--ink-soft); margin-bottom: 3px; }
.lab-eqs { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; }
.lab-eqs code {
  font-family: var(--font); font-size: 11px; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line-soft);
  border-radius: 6px; padding: 4px 6px;
}

.lab-reagents { display: flex; flex-direction: column; gap: 2px; }
.lab-reagent {
  display: flex; align-items: center; gap: 8px; text-align: left;
  padding: 5px 7px; border-radius: 8px; border: 1px solid transparent;
  transition: background .12s, border-color .12s;
}
.lab-reagent:hover { background: var(--shell); border-color: var(--line); }
.lab-reagent.off { opacity: .45; }
.lab-rname { font-size: 11.5px; color: var(--ink-soft); }

.lab-hints { display: flex; flex-wrap: wrap; gap: 4px; }

/* a lab page shows a flask where a thumbnail would be */
.pg-thumb.lab { display: grid; place-items: center; background: var(--shell); }
.pg-thumb.lab svg { width: 13px; height: 13px; color: var(--muted); }

@media (max-width: 980px) {
  .lab { width: 250px; }
  .app[data-sidebar="open"] .lab { display: none; }
}

/* ---- assistant HUD ---- */

.hud {
  position: absolute; z-index: 22;
  right: 16px; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; gap: 10px;
}

.hud-capsule {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px; border-radius: 999px;
  background: var(--paper); border: 1px solid var(--line);
  box-shadow: var(--sh-2);
}
.hud-capsule .hud-sep { width: 18px; height: 1px; background: var(--line); margin: 3px 0; }
.hud-btn { width: 34px; height: 34px; border-radius: 999px; }
.hud-btn svg { width: 17px; height: 17px; }
.hud-btn.on { background: var(--ink); color: var(--paper); }

/* the wake word breathes while it is actually listening */
.hud-btn.listening::after {
  content: ''; position: absolute; inset: -3px;
  border-radius: 999px; border: 1.5px solid var(--ink);
  animation: hud-ring 2.4s var(--ease) infinite;
  pointer-events: none;
}

.hud-mic {
  display: grid; place-items: center;
  width: 42px; height: 42px; border-radius: 999px;
  background: var(--ink); color: var(--paper);
  margin-bottom: 2px; position: relative;
  transition: transform .14s var(--ease), background .14s;
}
.hud-mic svg { width: 20px; height: 20px; }
.hud-mic:hover { transform: translateY(-1.5px); background: #000; }
.hud-mic:active { transform: translateY(0) scale(.93); }

/* listening: a slow ring breathing out of the button */
.hud-mic.on::after {
  content: ''; position: absolute; inset: -4px;
  border-radius: 999px; border: 1.5px solid var(--ink);
  animation: hud-ring 1.6s var(--ease) infinite;
}
@keyframes hud-ring {
  0%   { transform: scale(.9);  opacity: .55; }
  70%  { transform: scale(1.3); opacity: 0; }
  100% { transform: scale(1.3); opacity: 0; }
}
.hud-mic.busy { background: var(--ink-soft); }

/* ---- the panel beside it ---- */

.hud-panel {
  width: 306px; max-width: 42vw;
  padding: 12px 13px 13px;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--sh-2);
  animation: hud-in .18s var(--ease) both;
}
@keyframes hud-in { from { opacity: 0; transform: translateX(8px); } }

.hud-status {
  display: flex; align-items: center; gap: 7px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .02em;
  text-transform: uppercase; color: var(--muted);
}
.hud-status.listening { color: var(--ink); }

.hud-wave { display: inline-flex; align-items: flex-end; gap: 2px; height: 13px; }
.hud-wave i {
  width: 2.5px; height: 4px; border-radius: 2px;
  background: var(--ink); animation: hud-bar .9s var(--ease) infinite;
}
.hud-wave i:nth-child(2) { animation-delay: .12s; }
.hud-wave i:nth-child(3) { animation-delay: .24s; }
.hud-wave i:nth-child(4) { animation-delay: .36s; }
@keyframes hud-bar { 0%, 100% { height: 4px; } 50% { height: 13px; } }

.hud-spin {
  width: 12px; height: 12px; border-radius: 50%;
  border: 1.6px solid var(--line); border-top-color: var(--ink);
  animation: hud-spin .7s linear infinite;
}
@keyframes hud-spin { to { transform: rotate(360deg); } }

.hud-q {
  margin: 9px 0 0; font-size: 12.5px; color: var(--muted);
  line-height: 1.45; overflow-wrap: anywhere;
}
.hud-heard {
  margin: 8px 0 0; font-size: 14px; line-height: 1.45;
  color: var(--ink); overflow-wrap: anywhere;
}
.hud-heard.dim { color: var(--faint); font-size: 13px; }

.hud-a {
  display: flex; gap: 7px; margin: 8px 0 0;
  font-size: 13.5px; line-height: 1.5; color: var(--ink);
  overflow-wrap: anywhere;
}
.hud-a svg { width: 15px; height: 15px; flex: none; margin-top: 2px; color: var(--muted); }

.hud-caveat {
  margin: 7px 0 0; font-size: 11.5px; line-height: 1.45; color: var(--muted);
  padding-left: 22px;
}

.hud-err {
  margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--ink-soft);
  padding-left: 9px; border-left: 2px solid var(--ink); overflow-wrap: anywhere;
}

/* ---- typed questions ---- */

.hud-compose {
  display: flex; align-items: flex-end; gap: 6px; margin-top: 10px;
  padding: 6px 6px 6px 10px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--shell);
  transition: border-color .14s;
}
.hud-compose:focus-within { border-color: var(--ink); background: var(--paper); }
.hud-input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: none; resize: none;
  font-size: 13.5px; line-height: 1.45; color: var(--ink);
  max-height: 132px; padding: 5px 0;
}
.hud-input::placeholder { color: var(--faint); }
.hud-send {
  display: grid; place-items: center; flex: none;
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--ink); color: var(--paper);
  transition: transform .13s var(--ease), background .13s;
}
.hud-send svg { width: 15px; height: 15px; stroke-width: 2; }
.hud-send:hover { transform: translateY(-1px); background: #000; }
.hud-send:active { transform: translateY(0) scale(.92); }

.hud-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.hud-chip {
  padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--paper);
  font-size: 11.5px; color: var(--muted); white-space: nowrap;
  transition: color .13s, border-color .13s, transform .13s var(--ease);
}
.hud-chip:hover { color: var(--ink); border-color: var(--ink); transform: translateY(-1px); }

/* ---- misc ---- */

.hidden { display: none !important; }
.drop-hint {
  position: absolute; inset: 12px; border: 2px dashed var(--ink); border-radius: var(--r-lg);
  background: rgba(255,255,255,.6); display: grid; place-items: center;
  font-weight: 600; z-index: 50; pointer-events: none;
}

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

@media (max-width: 980px) {
  .home-inner { padding: 26px 22px 80px; }
  .home-title { font-size: 32px; margin-top: 38px; }
  .minimap { display: none; }
}
@media (max-width: 720px) {
  .toolbar { gap: 0; padding: 4px; bottom: 12px; max-width: calc(100vw - 20px); overflow-x: auto; }
  .tool { width: 34px; height: 34px; }
  .tool-options { bottom: 62px; width: min(280px, calc(100vw - 24px)); }
  .topleft { max-width: calc(100vw - 150px); }
  .crumb-nb { display: none; }
  .crumb-sep { display: none; }
  .save-status span { display: none; }
  .zoomctl { bottom: 60px; right: 12px; }
  .home-search { width: 160px; }
  :root { --sb-w: 82vw; }
  [data-tip]::after { display: none; }

  /* The capsule stays put; the panel drops below it so it can use the width. */
  .hud { right: 10px; top: 46%; align-items: flex-start; }
  .hud-mic { width: 38px; height: 38px; }
  .hud-btn { width: 31px; height: 31px; }
  .hud-panel {
    position: absolute; right: 0; top: calc(100% + 10px);
    width: min(320px, calc(100vw - 24px)); max-width: none;
  }
}
@media (hover: none) {
  .row-menu, .card-menu { opacity: 1; }
}
