/* ============================================================
   Checkerboard — mind mapping SPA
   Widescreen-first layout: top command bar, left outline panel,
   full-bleed infinite canvas.
   ============================================================ */

:root {
  --bg: #0e1117;
  --bg-soft: #151a23;
  --panel: #131822;
  --panel-2: #1a2130;
  --line: #263041;
  --line-soft: #1e2635;
  --text: #e6ecf5;
  --text-dim: #93a1b8;
  --text-faint: #64748b;
  --accent: #5b8cff;
  --accent-soft: rgba(91, 140, 255, .16);
  --danger: #f4676b;
  --grid: rgba(255, 255, 255, .045);
  --node-bg: #1b2434;
  --node-bg-hover: #212c40;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --radius: 10px;
  --topbar-h: 52px;
  --sidebar-w: 340px;
  --comments-w: 330px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="light"] {
  --bg: #f6f7fb;
  --bg-soft: #eef1f7;
  --panel: #ffffff;
  --panel-2: #f3f5fa;
  --line: #dbe1ec;
  --line-soft: #e7ebf3;
  --text: #131a26;
  --text-dim: #566275;
  --text-faint: #8b97a9;
  --accent: #2f6bff;
  --accent-soft: rgba(47, 107, 255, .12);
  --danger: #d93a41;
  --grid: rgba(20, 30, 50, .05);
  --node-bg: #ffffff;
  --node-bg-hover: #f4f7ff;
  --shadow: 0 10px 26px rgba(20, 30, 60, .12);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#app { display: flex; flex-direction: column; height: 100%; }

/* ---------------- top bar ---------------- */

#topbar {
  height: var(--topbar-h);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
#topbar::-webkit-scrollbar { display: none; }

.brand { display: flex; align-items: baseline; gap: 7px; padding-right: 6px; white-space: nowrap; }
.brand-mark {
  width: 20px; height: 20px; align-self: center;
  fill: none; stroke: var(--accent); stroke-width: 1.6;
}
.brand-mark rect { fill: var(--accent-soft); }
.brand-name { font-weight: 650; letter-spacing: .2px; }
.brand-sub { color: var(--text-faint); font-size: 11px; letter-spacing: .4px; text-transform: uppercase; }

.toolgroup {
  display: flex; align-items: center; gap: 4px;
  padding: 3px; border: 1px solid var(--line-soft); border-radius: 9px;
  background: var(--bg-soft); white-space: nowrap;
}
.spacer { flex: 1 1 auto; min-width: 4px; }

.btn {
  appearance: none; border: 0; cursor: pointer;
  background: transparent; color: var(--text);
  font: inherit; font-size: 13px; line-height: 1;
  padding: 7px 10px; border-radius: 7px;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .12s ease, color .12s ease, transform .06s ease;
}
.btn:hover { background: var(--panel-2); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn.icon { padding: 7px 9px; font-size: 14px; }
.btn.ghost { color: var(--text-dim); }
.btn.primary { background: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.danger:hover { background: rgba(244, 103, 107, .16); color: var(--danger); }
.btn[disabled] { opacity: .38; pointer-events: none; }
.btn .ico { font-size: 12px; color: var(--text-dim); }
.toggle-btn { border: 1px solid transparent; }
.toggle-btn.is-on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.toggle-btn.is-on .ico { color: inherit; }

.zoom-label { font-variant-numeric: tabular-nums; min-width: 58px; justify-content: center; color: var(--text-dim); }

.seg select {
  appearance: none; background: transparent; border: 0; color: var(--text);
  font: inherit; font-size: 13px; padding: 6px 22px 6px 8px; border-radius: 7px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-faint) 50%),
                    linear-gradient(135deg, var(--text-faint) 50%, transparent 50%);
  background-position: calc(100% - 12px) 50%, calc(100% - 8px) 50%;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}
.seg select:focus { outline: none; background-color: var(--panel-2); }
.seg option { background: var(--panel); color: var(--text); }

.search-group { padding-left: 8px; }
#search {
  background: transparent; border: 0; color: var(--text); font: inherit; font-size: 13px;
  padding: 6px 2px; width: 190px;
}
#search:focus { outline: none; }
#search::placeholder { color: var(--text-faint); }
.search-count { color: var(--text-faint); font-size: 12px; padding-right: 6px; font-variant-numeric: tabular-nums; }

.g-mark { display: inline-flex; align-items: center; }
.account-chip { gap: 7px; padding-left: 5px; }
.account-chip .avatar { width: 20px; height: 20px; font-size: 9px; background: var(--accent); }
.account-chip .avatar img { width: 100%; height: 100%; border-radius: 50%; display: block; }
.menu-head {
  padding: 8px 10px 9px; border-bottom: 1px solid var(--line-soft); margin-bottom: 4px;
  display: flex; flex-direction: column; gap: 2px;
}
.menu-head b { font-size: 12.5px; }
.menu-head span { color: var(--text-faint); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; }

.menu { position: relative; }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); padding: 5px; min-width: 172px;
}
.menu-list button {
  display: block; width: 100%; text-align: left; background: transparent; border: 0;
  color: var(--text); font: inherit; font-size: 13px; padding: 8px 10px; border-radius: 7px; cursor: pointer;
}
.menu-list button:hover { background: var(--panel-2); }

/* ---------------- main split ---------------- */

#main { flex: 1 1 auto; display: flex; min-height: 0; }

#sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  display: flex; flex-direction: column; min-height: 0;
  background: var(--panel); border-right: 1px solid var(--line);
}
#sidebar.hidden { display: none; }

.side-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 8px 0 10px; border-bottom: 1px solid var(--line-soft);
}
.tabs { display: flex; gap: 2px; }
.tab {
  background: transparent; border: 0; cursor: pointer; color: var(--text-dim);
  font: inherit; font-size: 13px; padding: 8px 12px; border-radius: 8px 8px 0 0;
  border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

.tabpane { display: none; flex-direction: column; gap: 10px; padding: 12px; min-height: 0; flex: 1 1 auto; }
.tabpane.active { display: flex; }

.hint { margin: 0; color: var(--text-dim); font-size: 12px; line-height: 1.5; }
.hint code { font-family: var(--mono); background: var(--panel-2); padding: 1px 4px; border-radius: 4px; }

#outline {
  flex: 1 1 auto; min-height: 180px; resize: none;
  background: var(--bg-soft); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; font-family: var(--mono); font-size: 12.5px; line-height: 1.65;
  tab-size: 2;
}
#outline:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.side-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.side-actions .btn { border: 1px solid var(--line); }
.side-actions .btn.primary { border-color: transparent; }
.btn.file { position: relative; overflow: hidden; }
.check { display: flex; align-items: center; gap: 7px; color: var(--text-dim); font-size: 12px; cursor: pointer; }
.check input { accent-color: var(--accent); }

.samples { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.samples-label { color: var(--text-faint); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.chip {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text-dim);
  font: inherit; font-size: 12px; padding: 5px 9px; border-radius: 999px; cursor: pointer;
}
.chip:hover { color: var(--text); border-color: var(--accent); }

/* inspector */
#inspector { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 11px; letter-spacing: .5px; text-transform: uppercase; color: var(--text-faint); }
.field input[type="text"], .field textarea {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); font: inherit; font-size: 13px; padding: 8px 10px;
}
.field textarea { min-height: 90px; resize: vertical; font-family: var(--sans); }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.swatch.active { border-color: var(--text); }
.meta { color: var(--text-faint); font-size: 12px; line-height: 1.7; }
.meta b { color: var(--text-dim); font-weight: 600; }
.empty { color: var(--text-faint); font-size: 13px; line-height: 1.6; }

/* ---------------- comments panel ---------------- */

#comments {
  width: var(--comments-w); flex: 0 0 var(--comments-w);
  display: flex; flex-direction: column; min-height: 0;
  background: var(--panel); border-left: 1px solid var(--line);
}

.comments-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
  padding: 11px 8px 11px 14px; border-bottom: 1px solid var(--line-soft);
}
.comments-heading { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.comments-title { font-weight: 620; font-size: 13px; }
.comments-node {
  color: var(--text-faint); font-size: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px;
}

/* The selected node's note is pinned above the thread: it is context for every
   comment below it, so it never scrolls away and is tinted to stand apart. */
.node-note {
  flex: 0 0 auto; margin: 12px 12px 0;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 42%, transparent);
  border-left-width: 3px;
  border-radius: 10px; padding: 9px 11px 10px;
}
.node-note-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.node-note-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .6px; font-weight: 650;
  color: var(--accent);
}
.node-note-top .comment-actions { margin: 0 0 0 auto; }
.node-note-body {
  font-size: 12.5px; line-height: 1.55; color: var(--text);
  white-space: pre-wrap; overflow-wrap: anywhere;
  max-height: 168px; overflow-y: auto;
}
.node-note-body.is-empty { color: var(--text-faint); font-style: italic; }
.node-note textarea {
  width: 100%; background: var(--panel); color: var(--text);
  border: 1px solid var(--accent); border-radius: 8px; padding: 8px;
  font: inherit; font-size: 12.5px; resize: vertical; min-height: 76px;
}
.node-note textarea:focus { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

.comments-scroll { flex: 1 1 auto; overflow-y: auto; padding: 12px; }
#comment-list { display: flex; flex-direction: column; gap: 10px; }

.comment {
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 11px;
}
.comment.resolved { opacity: .62; }
.comment-top { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.avatar {
  width: 22px; height: 22px; border-radius: 50%; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 650; color: #fff; letter-spacing: .3px;
}
.comment-author { font-size: 12.5px; font-weight: 600; }
.comment-time { color: var(--text-faint); font-size: 11px; margin-left: auto; white-space: nowrap; }
.comment-body { font-size: 13px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-tag {
  font-size: 10px; text-transform: uppercase; letter-spacing: .5px;
  color: #43c98a; border: 1px solid currentColor; border-radius: 999px; padding: 1px 6px;
}
.comment-actions { display: flex; gap: 2px; margin-top: 8px; }
.comment-actions button {
  background: transparent; border: 0; color: var(--text-faint); cursor: pointer;
  font: inherit; font-size: 11.5px; padding: 4px 7px; border-radius: 6px;
}
.comment-actions button:hover { background: var(--panel-2); color: var(--text); }
.comment-actions button.destructive:hover { color: var(--danger); background: rgba(244, 103, 107, .14); }
.comment-edit {
  width: 100%; background: var(--panel); color: var(--text);
  border: 1px solid var(--accent); border-radius: 8px; padding: 8px;
  font: inherit; font-size: 13px; resize: vertical;
}

.comment-form { border-top: 1px solid var(--line-soft); padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.comment-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.comment-as { color: var(--text-faint); font-size: 12px; display: flex; align-items: center; gap: 5px; }
.comment-as input {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 6px;
  color: var(--text); font: inherit; font-size: 12px; padding: 4px 7px; width: 110px;
}
.comment-as input:focus { outline: none; border-color: var(--accent); }
#comment-input {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); font: inherit; font-size: 13px; padding: 9px 10px; resize: vertical; min-height: 62px;
}
#comment-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#comment-input:disabled, .comment-as input:disabled { opacity: .5; }
.comment-form .btn.primary { justify-content: center; }

.comments-empty { color: var(--text-faint); font-size: 12.5px; line-height: 1.6; text-align: center; padding: 26px 10px; }

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

/* `clip` (with `hidden` as the fallback) keeps the stage from becoming a scroll
   container: focusing a node label or the canvas would otherwise scroll the
   hidden overflow box and shift the whole map sideways. */
#stage { position: relative; flex: 1 1 auto; min-width: 0; overflow: hidden; overflow: clip; }

#canvas {
  position: absolute; inset: 0; outline: none;
  background-color: var(--bg);
  background-image: radial-gradient(var(--grid) 1px, transparent 1px);
  background-size: 26px 26px;
  cursor: grab;
  touch-action: none;
}
#canvas.panning { cursor: grabbing; }

#edges { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
#edges path { fill: none; stroke-linecap: round; }

#nodes { position: absolute; inset: 0; transform-origin: 0 0; }

.node {
  position: absolute;
  display: flex; align-items: center;
  background: var(--node-bg);
  border: 1px solid var(--line);
  border-left: 3px solid var(--branch, var(--accent));
  border-radius: 9px;
  padding: 7px 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .18);
  cursor: default;
  user-select: none;
  transition: background .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.node.flip { border-left: 1px solid var(--line); border-right: 3px solid var(--branch, var(--accent)); }
.node:hover { background: var(--node-bg-hover); }
.node.root {
  border: 1px solid transparent;
  background: linear-gradient(135deg, var(--accent), #8a6bff);
  color: #fff; font-weight: 640; box-shadow: var(--shadow);
}
.node.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.node.match { outline: 2px dashed #f0b429; outline-offset: 2px; }
.node.drag-source { opacity: .45; }
.node.drop-target { box-shadow: 0 0 0 3px rgba(80, 200, 140, .45); border-color: #43c98a; }
.node.editing { cursor: text; }

.node .label {
  display: block; white-space: pre-wrap; overflow-wrap: anywhere;
  line-height: 1.35; font-size: 13.5px; outline: none;
}
.node.root .label { font-size: 15px; }
.node .label[contenteditable="true"] { cursor: text; min-width: 8px; }

.node .badge {
  margin-left: 8px; font-size: 10.5px; color: var(--text-faint);
  background: var(--panel-2); border-radius: 999px; padding: 1px 6px; font-variant-numeric: tabular-nums;
}
.node.root .badge { background: rgba(255, 255, 255, .2); color: #fff; }
.node .comment-chip {
  margin-left: 7px; display: inline-flex; align-items: center; gap: 3px;
  font-size: 10.5px; color: var(--text-dim); background: var(--panel-2);
  border-radius: 999px; padding: 1px 7px; cursor: pointer; flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}
.node .comment-chip:hover { color: var(--accent); }
.node.root .comment-chip { background: rgba(255, 255, 255, .2); color: #fff; }
.node.has-open-comments { border-top-color: #f0b429; }

.node .note-dot { margin-left: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--text-faint); flex: 0 0 auto; }

.node-btn {
  position: absolute; width: 20px; height: 20px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--panel);
  color: var(--text-dim); font-size: 12px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0; opacity: 0; transition: opacity .12s ease, color .12s ease;
}
.node:hover .node-btn, .node.selected .node-btn, .node-btn.pinned { opacity: 1; }
.node-btn:hover { color: var(--text); border-color: var(--accent); }
.node-btn.toggle { font-variant-numeric: tabular-nums; font-size: 10px; }

/* measuring sandbox, mirrors node typography */
#measure {
  position: absolute; visibility: hidden; pointer-events: none;
  left: -9999px; top: -9999px;
  padding: 7px 12px; border: 1px solid transparent; border-left-width: 3px;
  font-family: var(--sans); font-size: 13.5px; line-height: 1.35;
  white-space: pre-wrap; overflow-wrap: anywhere;
}

/* ---------------- minimap + status ---------------- */

#minimap {
  position: absolute; right: 14px; bottom: 42px; width: 210px; height: 132px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
  overflow: hidden; cursor: pointer;
}
#minimap-canvas { width: 100%; height: 100%; display: block; }
#minimap-view {
  position: absolute; border: 1.5px solid var(--accent);
  background: var(--accent-soft); border-radius: 3px; pointer-events: none;
}

#statusbar {
  position: absolute; left: 0; right: 0; bottom: 0; height: 30px;
  display: flex; align-items: center; gap: 8px; padding: 0 14px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  border-top: 1px solid var(--line);
  color: var(--text-faint); font-size: 12px;
}
#statusbar .dot { opacity: .5; }
#status-sel { color: var(--text-dim); max-width: 34ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#status-hint { margin-left: auto; }

.floating {
  position: absolute; left: 10px; top: 10px; z-index: 5;
  background: var(--panel); border: 1px solid var(--line); color: var(--text-dim);
  border-radius: 8px; padding: 6px 10px; cursor: pointer; font: inherit;
}
.floating:hover { color: var(--text); }

/* ---------------- modal + toast ---------------- */

.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(5, 8, 14, .55);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(2px);
}
.modal-card {
  width: min(560px, 92vw); background: var(--panel);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 18px 20px 22px;
}
.modal-card header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-card h2 { margin: 0; font-size: 16px; font-weight: 650; }
.modal-card.wide { width: min(720px, 94vw); }
.modal-card .hint { margin-bottom: 12px; }
.modal-card .field { margin-bottom: 12px; }

.scopes { display: grid; gap: 8px; margin-bottom: 14px; }
.scope {
  display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: baseline;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer;
}
.scope:hover { border-color: var(--accent); }
.scope input { grid-row: span 2; align-self: center; accent-color: var(--accent); }
.scope-title { font-size: 13px; font-weight: 600; }
.scope-note { color: var(--text-dim); font-size: 12px; line-height: 1.45; }
.scope-note code, .modal-card .hint code {
  font-family: var(--mono); font-size: 11.5px; background: var(--panel-2); padding: 1px 4px; border-radius: 4px;
}
.scope:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

.account-mode { color: var(--text-faint); font-size: 11px; }
.account-mode.unverified { color: #f0b429; }

.maps-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; max-height: 320px; overflow-y: auto; }
.map-row {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px;
}
.map-row.current { border-color: var(--accent); background: var(--accent-soft); }
.map-row-main { min-width: 0; flex: 1 1 auto; }
.map-row-title { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-row-meta { color: var(--text-faint); font-size: 11.5px; margin-top: 2px; }
.map-row .comment-actions { margin: 0; }
.maps-empty { color: var(--text-faint); font-size: 12.5px; text-align: center; padding: 22px 10px; }
#map-title {
  flex: 1 1 auto; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); font: inherit; font-size: 13px; padding: 8px 10px; margin-right: auto;
}
#map-title:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#status-sync.saving { color: var(--accent); }
#status-sync.dirty { color: #f0b429; }

.preview {
  margin: 0 0 14px; max-height: 280px; overflow: auto;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; font-family: var(--mono); font-size: 12px; line-height: 1.55;
  color: var(--text-dim); white-space: pre;
}
.preview .k { color: var(--accent); }
.preview .c { color: var(--text-faint); font-style: italic; }
.preview .s { color: var(--text); }

.modal-actions { display: flex; align-items: center; gap: 8px; }
.modal-actions .btn { border: 1px solid var(--line); }
.modal-actions .btn.primary { border-color: transparent; }
.preview-meta { color: var(--text-faint); font-size: 12px; margin-right: auto; }

.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 22px; }
.keys > div { display: flex; align-items: center; gap: 6px; color: var(--text-dim); font-size: 12.5px; }
.keys span { color: var(--text-dim); }
kbd {
  font-family: var(--mono); font-size: 11px; background: var(--panel-2);
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px;
  padding: 2px 6px; color: var(--text);
}

.toast {
  position: fixed; left: 50%; bottom: 52px; transform: translateX(-50%);
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  padding: 9px 16px; border-radius: 999px; box-shadow: var(--shadow); font-size: 13px; z-index: 120;
}

/* narrow fallback — the app targets widescreen, but stays usable */
@media (max-width: 1400px) {
  :root { --comments-w: 300px; }
}
@media (max-width: 1100px) {
  :root { --sidebar-w: 280px; }
  #search { width: 130px; }
  #minimap { display: none; }
}
@media (max-width: 820px) {
  #comments { position: absolute; right: 0; z-index: 20; height: calc(100% - var(--topbar-h)); box-shadow: var(--shadow); }
  #sidebar { position: absolute; z-index: 20; height: calc(100% - var(--topbar-h)); box-shadow: var(--shadow); }
  .keys { grid-template-columns: 1fr; }
}
