:root {
  --bg: #ffffff;
  --bg-soft: #f7f7f5;
  --bg-hover: #efeeec;
  --bg-active: #e8e7e4;
  --sidebar-bg: #f7f7f5;
  --border: #ececea;
  --text: #37352f;
  --text-soft: #787774;
  --text-muted: #9b9a97;
  --accent: #2383e2;
  --accent-soft: #e7f0fb;
  --danger: #eb5757;
  --code-bg: #f2f1ee;
  --shadow-sm: 0 1px 2px rgba(15, 15, 15, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 15, 15, 0.12);
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #191919;
  --bg-soft: #202020;
  --bg-hover: #2a2a2a;
  --bg-active: #333333;
  --sidebar-bg: #202020;
  --border: #2f2f2f;
  --text: #e8e8e6;
  --text-soft: #9b9a97;
  --text-muted: #6b6b6b;
  --accent: #529cca;
  --accent-soft: #263748;
  --code-bg: #2a2a2a;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

#app {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

#mobile-menu {
  display: none;
  position: fixed;
  top: 10px; left: 10px;
  z-index: 80;
  width: 38px; height: 38px;
  border-radius: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm);
}
#sidebar-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 85;
}

/* ---------- Sidebar (Notion-2025 look) ---------- */
#sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 4px 0 0;
}

.ws-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px 8px;
}
.ws-avatar {
  width: 26px; height: 26px;
  border-radius: 6px;
  background: linear-gradient(135deg, #2a2a2a 0%, #1c1c1c 100%);
  color: #ff8a3d;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
}
[data-theme="light"] .ws-avatar {
  background: linear-gradient(135deg, #f5f4f2 0%, #e9e8e5 100%);
  color: #e75720;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);
}
.ws-name {
  flex: 1;
  font-weight: 600;
  font-size: 14.5px;
  letter-spacing: -0.01em;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ws-cog {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.ws-cog:hover { background: var(--bg-hover); color: var(--text); }

.top-nav {
  display: flex; align-items: center;
  gap: 2px;
  padding: 6px 8px 10px;
  overflow-x: auto;
}
.top-nav::-webkit-scrollbar { display: none; }
.nav-pill {
  height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
  position: relative;
  flex-shrink: 0;
}
.nav-pill svg { display: block; }
.nav-pill:hover { background: var(--bg-hover); color: var(--text); }
.nav-pill.active {
  background: var(--bg-hover);
  color: var(--text);
  padding-right: 14px;
}
.nav-pill:not(.active) .nav-label { display: none; }
.nav-pill .badge {
  position: absolute;
  top: 2px; right: -2px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  background: #eb5757;
  color: white;
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px var(--sidebar-bg);
}
.nav-pill .badge:empty, .nav-pill .badge.zero { display: none; }

.side-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0 12px;
  overflow-x: hidden;
}
.side-section {
  padding: 8px 4px 4px;
}
.side-label {
  padding: 4px 12px 6px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* Recent items & tree */
#recents-list, #page-tree {
  padding: 0 4px;
}
.tree-item, .recent-item {
  display: flex; align-items: center;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  gap: 6px;
  color: var(--text);
  min-height: 30px;
  user-select: none;
}
.tree-item:hover, .recent-item:hover { background: var(--bg-hover); }
.tree-item.active, .recent-item.active { background: var(--bg-active); }
.tree-toggle {
  width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 3px;
  color: var(--text-muted);
  font-size: 10px;
  flex-shrink: 0;
  transition: transform 0.1s ease;
}
.tree-toggle.leaf { visibility: hidden; }
.tree-toggle:hover { background: var(--bg-active); color: var(--text); }
.tree-icon, .recent-icon {
  flex-shrink: 0;
  width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px;
  color: var(--text-soft);
}
.tree-icon.doc-icon svg, .recent-icon svg { width: 15px; height: 15px; }
.tree-title, .recent-title {
  flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-weight: 400;
}
.tree-item.active .tree-title, .recent-item.active .recent-title { font-weight: 600; }
.tree-add {
  width: 22px; height: 22px;
  display: none;
  align-items: center; justify-content: center;
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 16px;
  flex-shrink: 0;
}
.tree-item:hover .tree-add { display: inline-flex; }
.tree-add:hover { background: var(--bg-active); color: var(--text); }
.tree-children { padding-left: 14px; }

.more-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 5px 10px;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 2px;
}
.more-btn:hover { background: var(--bg-hover); color: var(--text); }
.more-btn .dots { letter-spacing: 1px; }

.side-mini {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 5px 10px;
  border-radius: 6px;
  color: var(--text-soft);
  font-size: 13px;
}
.side-mini:hover { background: var(--bg-hover); color: var(--text); }

.side-footer {
  padding: 10px 12px 12px;
  border-top: 1px solid var(--border);
}
.new-pill {
  width: 100%;
  height: 40px;
  border-radius: 999px;
  background: var(--bg-hover);
  color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: inset 0 0 0 1px var(--border);
}
.new-pill:hover { background: var(--bg-active); }
.new-pill svg { color: var(--text-soft); }

/* ---------- Editor ---------- */
#editor-container {
  overflow-y: auto;
  background: var(--bg);
  position: relative;
}
#breadcrumb {
  padding: 12px 60px;
  font-size: 13px;
  color: var(--text-soft);
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px;
}
.crumb { cursor: pointer; padding: 2px 6px; border-radius: 4px; }
.crumb:hover { background: var(--bg-hover); color: var(--text); }
.crumb-sep { color: var(--text-muted); }

#page-body {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 60px 200px;
}
#page-header {
  display: flex; align-items: flex-end; gap: 10px;
  padding-top: 40px;
  margin-bottom: 20px;
}
#page-icon {
  font-size: 60px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
}
#page-icon:hover { background: var(--bg-hover); }
#page-title {
  flex: 1;
  border: none; outline: none; background: transparent;
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.02em;
  padding: 8px 0;
  color: var(--text);
}
#page-title::placeholder { color: var(--text-muted); }

#blocks-container { display: flex; flex-direction: column; gap: 2px; }

.block {
  position: relative;
  padding: 3px 0;
  display: flex;
  align-items: flex-start;
  gap: 2px;
}
.block-controls {
  position: absolute;
  left: -46px;
  top: 5px;
  display: none;
  gap: 2px;
}
.block:hover .block-controls { display: flex; }
.block-btn {
  width: 20px; height: 22px;
  color: var(--text-muted);
  border-radius: 3px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.block-btn:hover { background: var(--bg-hover); color: var(--text); }

.block-content {
  flex: 1;
  outline: none;
  padding: 3px 2px;
  min-height: 1.6em;
  word-wrap: break-word;
}
.block-content:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  pointer-events: none;
}

/* Block types */
.block-heading-1 .block-content {
  font-size: 30px; font-weight: 700; letter-spacing: -0.015em;
  padding-top: 24px; padding-bottom: 4px;
}
.block-heading-2 .block-content {
  font-size: 24px; font-weight: 600;
  padding-top: 18px; padding-bottom: 2px;
}
.block-heading-3 .block-content {
  font-size: 19px; font-weight: 600;
  padding-top: 12px; padding-bottom: 2px;
}
.block-quote {
  border-left: 3px solid var(--text);
  padding-left: 14px;
  margin: 4px 0;
}
.block-quote .block-content { padding-left: 4px; }
.block-callout {
  background: var(--bg-soft);
  border-radius: 6px;
  padding: 12px 14px;
  gap: 10px;
}
.callout-icon { font-size: 20px; }
.block-code {
  position: relative;
}
.block-code .block-content {
  background: var(--code-bg);
  border-radius: 6px;
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.code-lang {
  position: absolute;
  top: 6px; right: 8px;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  text-transform: lowercase;
  pointer-events: none;
}
.block-divider {
  padding: 12px 0;
}
.block-divider hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0;
  width: 100%;
}
.list-marker {
  padding-top: 4px;
  width: 22px;
  text-align: center;
  color: var(--text);
  flex-shrink: 0;
}
.block-todo .checkbox {
  margin-top: 6px;
  width: 16px; height: 16px;
  border: 1.5px solid var(--text-soft);
  border-radius: 3px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  color: white; font-size: 12px;
  flex-shrink: 0;
}
.block-todo.checked .checkbox {
  background: var(--accent);
  border-color: var(--accent);
}
.block-todo.checked .checkbox::after { content: "✓"; }
.block-todo.checked .block-content {
  color: var(--text-muted);
  text-decoration: line-through;
}

.block-link .link-card {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  cursor: pointer;
  width: 100%;
  font-size: 14px;
}
.block-link .link-card:hover { background: var(--bg-hover); }
.block-link .link-icon { font-size: 18px; }

.image-wrap { padding: 8px 0; max-width: 100%; }
.image-wrap img { max-width: 100%; border-radius: 6px; display: block; }
.image-caption { font-size: 12px; color: var(--text-soft); margin-top: 4px; }
.image-missing { color: var(--text-muted); font-size: 13px; padding: 10px; border: 1px dashed var(--border); border-radius: 6px; }

/* ---------- AI Panel ---------- */
#ai-panel {
  position: fixed;
  right: 0; top: 0; bottom: 0;
  width: 420px;
  max-width: 100vw;
  background: var(--bg);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-md);
  z-index: 95;
  transform: translateX(105%);
  visibility: hidden;
  transition: transform 0.25s ease, visibility 0.25s;
}
#ai-panel.open { transform: translateX(0); visibility: visible; }
.ai-header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.ai-title { flex: 1; font-weight: 600; }
#ai-messages {
  flex: 1; overflow-y: auto;
  padding: 14px;
  display: flex; flex-direction: column; gap: 12px;
}
.ai-msg {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.55;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.ai-msg.user { background: var(--accent-soft); align-self: flex-end; max-width: 90%; white-space: pre-wrap; }
.ai-msg.assistant { background: var(--bg-soft); }
.ai-msg.system { background: transparent; color: var(--text-soft); font-size: 13px; padding: 4px 0; }
.ai-msg.error { background: #fde8e8; color: #b91c1c; white-space: pre-wrap; }
[data-theme="dark"] .ai-msg.error { background: #4a1e1e; color: #fca5a5; }

/* Rendered markdown inside an assistant message */
.ai-msg .ai-p { margin: 0 0 8px; }
.ai-msg .ai-p:last-child { margin-bottom: 0; }
.ai-msg .ai-h { font-weight: 700; margin: 12px 0 6px; line-height: 1.3; }
.ai-msg .ai-h:first-child { margin-top: 0; }
.ai-msg .ai-h1 { font-size: 18px; }
.ai-msg .ai-h2 { font-size: 16px; }
.ai-msg .ai-h3 { font-size: 15px; }
.ai-msg .ai-h4 { font-size: 14px; color: var(--text-soft); }
.ai-msg .ai-list { margin: 4px 0 8px; padding-left: 20px; }
.ai-msg .ai-list li { margin: 2px 0; }
.ai-msg .ai-quote {
  border-left: 3px solid var(--border);
  padding-left: 10px; margin: 6px 0;
  color: var(--text-soft);
}
.ai-msg .ai-inline-code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--code-bg);
  padding: 1px 5px;
  border-radius: 4px;
}
.ai-msg .ai-code {
  position: relative;
  background: var(--code-bg);
  border-radius: 6px;
  padding: 12px 14px;
  margin: 8px 0;
  overflow-x: auto;
}
.ai-msg .ai-code code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  white-space: pre;
  display: block;
  color: var(--text);
}
.ai-msg .ai-code-lang {
  position: absolute; top: 4px; right: 8px;
  font-size: 10px; color: var(--text-muted);
  font-family: var(--font-mono);
}
.ai-msg hr { border: none; border-top: 1px solid var(--border); margin: 10px 0; }

.ai-actions { margin-top: 10px; display: flex; gap: 6px; }
.ai-msg .insert-btn {
  font-size: 12px; padding: 4px 10px;
  border-radius: 4px;
  background: var(--accent); color: white;
}
.ai-msg .insert-btn:hover { filter: brightness(1.05); }
.ai-msg .copy-btn {
  font-size: 12px; padding: 4px 10px;
  border-radius: 4px;
  background: var(--bg-active); color: var(--text);
}

.ai-quick {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
}
.ai-quick button {
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 12px;
  background: var(--bg-soft);
  color: var(--text-soft);
}
.ai-quick button:hover { background: var(--bg-hover); color: var(--text); }

.ai-input-wrapper {
  border-top: 1px solid var(--border);
  padding: 10px;
  display: flex; gap: 8px;
}
#ai-input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-soft);
  resize: none;
  font-size: 14px;
  outline: none;
}
#ai-input:focus { border-color: var(--accent); }
#ai-send {
  padding: 0 16px;
  background: var(--accent);
  color: white;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
}
#ai-send:hover { filter: brightness(1.05); }
#ai-send:disabled { opacity: 0.6; cursor: default; }

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0;
  background: rgba(15, 15, 15, 0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal.hidden { display: none; }
.modal-content {
  background: var(--bg);
  border-radius: 10px;
  padding: 24px;
  width: 460px;
  max-width: 92vw;
  box-shadow: var(--shadow-md);
}
.modal-content h2 { margin: 0 0 16px; font-size: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12px; color: var(--text-soft); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.field input, .field select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-soft);
  font-size: 14px; outline: none;
}
.field input:focus, .field select:focus { border-color: var(--accent); }
.hint { font-size: 12px; color: var(--text-muted); }
.hint a { color: var(--accent); text-decoration: none; }
.modal-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 20px;
}
.btn-primary, .btn-secondary {
  padding: 8px 16px; border-radius: 6px; font-size: 13px; font-weight: 600;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { filter: brightness(1.05); }
.btn-secondary { background: var(--bg-hover); color: var(--text); }
.btn-secondary:hover { background: var(--bg-active); }

.search-content { padding: 12px; }
#search-input {
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  font-size: 16px; outline: none;
}
#search-results { max-height: 400px; overflow-y: auto; margin-top: 8px; }
.search-result {
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: flex; align-items: center; gap: 8px;
}
.search-result:hover { background: var(--bg-hover); }
.search-empty { padding: 16px; text-align: center; color: var(--text-muted); font-size: 14px; }
.inbox-title { padding: 10px 12px; font-size: 14px; font-weight: 600; color: var(--text); border-bottom: 1px solid var(--border); }
#inbox-list { max-height: 460px; overflow-y: auto; padding: 6px 8px 10px; }
.inbox-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.inbox-row:hover { background: var(--bg-hover); }
.inbox-check {
  margin-top: 2px;
  width: 16px; height: 16px;
  border: 1.5px solid var(--text-soft);
  border-radius: 3px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: white; font-size: 11px;
}
.inbox-check.checked { background: var(--accent); border-color: var(--accent); }
.inbox-check.checked::after { content: "✓"; }
.inbox-body { flex: 1; }
.inbox-text { font-size: 14px; color: var(--text); }
.inbox-src { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ---------- Slash menu ---------- */
#slash-menu, #context-menu {
  position: fixed;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  padding: 6px;
  min-width: 260px;
  max-height: 320px;
  overflow-y: auto;
  z-index: 200;
}
#slash-menu.hidden, #context-menu.hidden { display: none; }
.slash-item, .ctx-item {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
}
.slash-item:hover, .slash-item.active, .ctx-item:hover { background: var(--bg-hover); }
.slash-icon {
  width: 34px; height: 34px;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg);
  font-size: 18px;
  flex-shrink: 0;
}
.slash-text { flex: 1; }
.slash-title { font-weight: 500; }
.slash-desc { font-size: 12px; color: var(--text-soft); }
.slash-section {
  padding: 6px 12px 4px;
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; font-weight: 600; letter-spacing: 0.05em;
}
.ctx-item.danger { color: var(--danger); }

/* Toast */
#toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 14px;
  box-shadow: var(--shadow-md);
  z-index: 300;
  max-width: min(92vw, 480px);
  text-align: center;
}
#toast.hidden { display: none; }

.hidden { display: none !important; }

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--bg-active); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  #app { grid-template-columns: 1fr; }
  #mobile-menu { display: inline-flex; }

  /* Sidebar becomes an overlay drawer */
  #sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: min(300px, 85vw);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 90;
    box-shadow: var(--shadow-md);
  }
  body.sidebar-open #sidebar { transform: translateX(0); }

  #breadcrumb { padding: 16px 16px 8px 58px; min-height: 38px; }
  #page-body { padding: 0 18px 140px; }
  #page-header { padding-top: 12px; }
  #page-icon { font-size: 40px; }
  #page-title { font-size: 28px; }
  .block-heading-1 .block-content { font-size: 24px; padding-top: 16px; }
  .block-heading-2 .block-content { font-size: 20px; padding-top: 12px; }
  .block-heading-3 .block-content { font-size: 17px; padding-top: 8px; }

  #ai-panel { width: 100%; }

  /* Block controls float above the block instead of hanging off-screen left */
  .block-controls {
    left: auto; right: 2px; top: -18px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1px;
    box-shadow: var(--shadow-sm);
    z-index: 5;
  }
  .block:focus-within .block-controls { display: flex; }

  .modal-content { width: min(460px, 94vw); padding: 18px; }
  #search-results, #inbox-list { max-height: 60vh; }
  #slash-menu, #context-menu { min-width: 240px; max-width: 92vw; }
}

/* Touch devices: no hover, so keep key affordances visible */
@media (hover: none) {
  .tree-add { display: inline-flex; }
  .block .block-controls { display: none; }
  .block:focus-within .block-controls { display: flex; }
  body { -webkit-tap-highlight-color: transparent; }
}
