/* Tiny Notes — Dark Magic Studio */

:root {
  --bg: #fbfbfc;
  --bg-sunk: #f2f3f6;
  --panel: #ffffff;
  --panel-alt: #f8f9fb;
  --border: #e6e7ed;
  --border-soft: #eef0f4;
  --text: #14151a;
  --muted: #5a6070;
  --faint: #8b91a1;
  --accent: #5b5bd6;
  --accent-hover: #4a4ac4;
  --accent-soft: #eeeeff;
  --accent-line: rgba(91, 91, 214, .22);
  --good: #0f8a72;
  --good-soft: #e6f5f1;
  --warn: #b4690e;
  --shadow-sm: 0 1px 2px rgba(16, 20, 32, .05);
  --shadow-md: 0 4px 16px rgba(16, 20, 32, .07), 0 1px 3px rgba(16, 20, 32, .04);
  --shadow-lg: 0 22px 60px rgba(16, 20, 32, .14), 0 2px 8px rgba(16, 20, 32, .05);
  --shadow-pop: 0 30px 80px rgba(12, 14, 24, .22);

  --r-xs: 7px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;

  --nav-h: 62px;
  --maxw: 1320px;

  --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --font-editor: var(--font-ui);
  --editor-width: 680px;
  --editor-size: 16.5px;
}

:root[data-theme="warm"] {
  --bg: #faf7f2;
  --bg-sunk: #f2ece2;
  --panel: #fffdfa;
  --panel-alt: #f8f3ea;
  --border: #ece3d5;
  --border-soft: #f3ebdf;
  --text: #221f19;
  --muted: #6a6053;
  --faint: #9a8f7e;
  --accent: #a5602c;
  --accent-hover: #8e5024;
  --accent-soft: #f7ebdd;
  --accent-line: rgba(165, 96, 44, .24);
  --good: #6b7a2f;
  --good-soft: #f0f2e0;
}

:root[data-theme="midnight"] {
  --bg: #0e0f14;
  --bg-sunk: #14161d;
  --panel: #16181f;
  --panel-alt: #1b1e26;
  --border: #272b36;
  --border-soft: #21242d;
  --text: #e8e9ef;
  --muted: #9ba1b1;
  --faint: #6f778a;
  --accent: #8b8cf5;
  --accent-hover: #a0a1f8;
  --accent-soft: #1e2038;
  --accent-line: rgba(139, 140, 245, .3);
  --good: #4fc0a4;
  --good-soft: #14261f;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 4px 18px rgba(0, 0, 0, .45);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, .6);
  --shadow-pop: 0 32px 90px rgba(0, 0, 0, .7);
}

:root[data-theme="paper"] {
  --bg: #f4f2ec;
  --bg-sunk: #eae7dd;
  --panel: #fbfaf6;
  --panel-alt: #f2f0e8;
  --border: #e0dccf;
  --border-soft: #eae6da;
  --text: #1d1c17;
  --muted: #605d51;
  --faint: #8f8b7c;
  --accent: #3f6b52;
  --accent-hover: #345742;
  --accent-soft: #e6eee8;
  --accent-line: rgba(63, 107, 82, .24);
  --good: #3f6b52;
  --good-soft: #e6eee8;
}

:root[data-font="serif"] { --font-editor: var(--font-serif); }
:root[data-font="mono"] { --font-editor: var(--font-mono); }

:root[data-width="compact"] { --editor-width: 560px; }
:root[data-width="comfortable"] { --editor-width: 680px; }
:root[data-width="wide"] { --editor-width: 860px; }

:root[data-size="small"] { --editor-size: 15px; }
:root[data-size="medium"] { --editor-size: 16.5px; }
:root[data-size="large"] { --editor-size: 18.5px; }

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color .25s ease, color .25s ease;
}

img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }

h1, h2, h3, h4 { margin: 0; line-height: 1.16; letter-spacing: -0.022em; font-weight: 650; }
p { margin: 0; }

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

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 26px; }
.wrap--narrow { max-width: 1080px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 300;
  background: var(--text); color: var(--bg); padding: 10px 16px;
}
.skip-link:focus { left: 0; }

/* ---------------- Buttons ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  padding: 9px 15px;
  font-size: 14px;
  font-weight: 550;
  cursor: pointer;
  background: transparent;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease,
              box-shadow .16s ease, transform .12s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; flex: none; }

.btn--primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px var(--accent-line), 0 6px 18px var(--accent-line);
}
.btn--primary:hover { background: var(--accent-hover); }

.btn--ghost {
  background: var(--panel);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.btn--ghost:hover { background: var(--panel-alt); border-color: var(--faint); }

.btn--quiet { color: var(--muted); }
.btn--quiet:hover { background: var(--bg-sunk); color: var(--text); }

.btn--lg { padding: 12px 22px; font-size: 15px; border-radius: 12px; }
.btn--sm { padding: 6px 11px; font-size: 13px; border-radius: var(--r-xs); }
.btn--block { width: 100%; }
.btn--danger:hover { background: #fdeceb; color: #b42318; border-color: #f5c6c2; }
:root[data-theme="midnight"] .btn--danger:hover { background: #2c1a1a; color: #ff9d95; border-color: #4a2724; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none; /* a toolbar row must never squash a square button into a sliver */
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color .16s ease, color .16s ease;
}
.icon-btn:hover { background: var(--bg-sunk); color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn.is-on { color: var(--accent); background: var(--accent-soft); }

.pro-badge {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-line);
  font-size: 10.5px;
  font-weight: 680;
  letter-spacing: .08em;
  text-transform: uppercase;
  flex: none;
}

.kbd {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--panel);
  color: var(--faint);
  font-size: 11.5px;
  font-weight: 560;
  font-family: var(--font-ui);
}

/* ---------------- Navigation ---------------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--nav-h);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
}
.nav__inner { display: flex; align-items: center; gap: 18px; height: 100%; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 640;
  font-size: 15.5px;
  letter-spacing: -0.02em;
  flex: none;
}
.brand__mark {
  width: 28px; height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #7c7cf0, #5b5bd6 55%, #3f3fae);
  box-shadow: 0 2px 8px var(--accent-line);
  flex: none;
}
.brand__mark svg { width: 15px; height: 15px; }

.nav__links { display: flex; align-items: center; gap: 2px; margin-left: 10px; }
.nav__links a {
  padding: 7px 11px;
  border-radius: var(--r-xs);
  font-size: 14px;
  font-weight: 520;
  color: var(--muted);
  transition: color .16s ease, background-color .16s ease;
}
.nav__links a:hover { color: var(--text); background: var(--bg-sunk); }
.nav__spacer { flex: 1; }

.nav__toggle {
  display: none;
  flex: none;
  width: 38px; height: 38px;
  align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  background: var(--panel);
  cursor: pointer;
}
.nav__toggle svg { width: 17px; height: 17px; }

.nav__mobile { display: none; border-bottom: 1px solid var(--border); background: var(--bg); }
.nav__mobile.is-open { display: block; }
.nav__mobile ul { list-style: none; margin: 0; padding: 8px 26px 14px; display: grid; gap: 2px; }
.nav__mobile a { display: block; padding: 10px 12px; border-radius: var(--r-xs); color: var(--muted); font-weight: 520; }
.nav__mobile a:hover { background: var(--bg-sunk); color: var(--text); }

/* ---------------- Sections ---------------- */

.section { padding: 88px 0; }
.section--sunk { background: var(--bg-sunk); border-block: 1px solid var(--border); }
.section__head { max-width: 620px; margin-bottom: 42px; }
.section__head--center { margin-inline: auto; text-align: center; }
.eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 640;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 11px;
}
.section__title { font-size: clamp(27px, 3.3vw, 38px); }
.section__sub { margin-top: 13px; color: var(--muted); font-size: 16.5px; }

/* ---------------- Hero ---------------- */

.hero {
  padding: 76px 0 64px;
  background:
    radial-gradient(820px 400px at 80% -14%, var(--accent-soft), transparent 62%),
    var(--bg);
}
.hero__inner { text-align: center; max-width: 760px; margin: 0 auto; }
.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  font-size: 13px;
  font-weight: 520;
  color: var(--muted);
  margin-bottom: 22px;
}
.hero__badge svg { width: 14px; height: 14px; color: var(--accent); }
.hero__title {
  font-size: clamp(38px, 6vw, 62px);
  letter-spacing: -0.038em;
  font-weight: 690;
}
.hero__tagline { margin-top: 10px; font-size: clamp(20px, 2.6vw, 26px); color: var(--muted); font-weight: 450; }
.hero__text { margin-top: 20px; font-size: 17.5px; color: var(--muted); max-width: 620px; margin-inline: auto; }
.hero__cta { margin-top: 30px; display: flex; gap: 11px; justify-content: center; flex-wrap: wrap; }
.hero__hint { margin-top: 18px; font-size: 13.5px; color: var(--faint); display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; }

/* ---------------- Workspace shell ---------------- */

.workspace {
  --sidebar-w: 244px;
  --list-w: 336px;
  height: min(860px, calc(100vh - 120px));
  min-height: 620px;
  display: grid;
  grid-template-columns: var(--sidebar-w) var(--list-w) minmax(0, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.ws-col { min-width: 0; display: flex; flex-direction: column; min-height: 0; }

/* Lives outside the grid at every width; only shown behind the mobile drawer. */
.sidebar-scrim { position: fixed; inset: 0; z-index: 125; background: rgba(12, 14, 24, .4); display: none; }
.ws-col + .ws-col { border-left: 1px solid var(--border); }

/* Sidebar */

.sidebar { background: var(--panel-alt); }
.sidebar__head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 16px 16px 12px;
}
.sidebar__scroll { flex: 1; overflow-y: auto; padding: 0 10px 12px; }

.side-group { margin-top: 6px; }
.side-group__title {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 8px 8px;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  font-weight: 660;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--faint);
  text-align: left;
}
.side-group__title svg { width: 12px; height: 12px; transition: transform .18s ease; }
.side-group.is-collapsed .side-group__title svg { transform: rotate(-90deg); }
.side-group.is-collapsed .side-group__items { display: none; }

.side-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--muted);
  font-size: 13.8px;
  font-weight: 520;
  cursor: pointer;
  text-align: left;
  transition: background-color .14s ease, color .14s ease;
}
.side-item:hover { background: var(--bg-sunk); color: var(--text); }
.side-item.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 570; }
.side-item svg { width: 15px; height: 15px; flex: none; }
.side-item__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-item__count {
  font-size: 11.5px;
  font-weight: 560;
  color: var(--faint);
  background: var(--bg-sunk);
  border-radius: 999px;
  padding: 1px 7px;
  flex: none;
}
.side-item.is-active .side-item__count { background: var(--panel); color: var(--accent); }
.side-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

.sidebar__foot { padding: 10px; border-top: 1px solid var(--border); display: grid; gap: 4px; }
.sidebar__foot .side-item.is-upgrade {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 570;
}
.sidebar__foot .side-item.is-upgrade:hover { background: var(--accent-soft); filter: brightness(.97); }

/* Note list */

.list__head { padding: 16px 16px 12px; border-bottom: 1px solid var(--border); }
.list__title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.list__title { font-size: 17px; font-weight: 640; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.search {
  position: relative;
  margin-top: 12px;
}
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--faint); pointer-events: none; }
.search input {
  width: 100%;
  padding: 9px 11px 9px 33px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg);
  font-size: 13.8px;
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-line); }
.search input::placeholder { color: var(--faint); }

.list__actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.list__actions .btn { flex: none; }

.list__scroll { flex: 1; overflow-y: auto; padding: 8px; }

.note-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: transparent;
  padding: 12px 13px;
  cursor: pointer;
  transition: background-color .14s ease, border-color .14s ease;
}
.note-item + .note-item { margin-top: 2px; }
.note-item:hover { background: var(--bg-sunk); }
.note-item.is-active { background: var(--accent-soft); border-color: var(--accent-line); }

.note-item__top { display: flex; align-items: baseline; gap: 8px; }
.note-item__title {
  flex: 1;
  min-width: 0;
  font-size: 14.4px;
  font-weight: 585;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.note-item__star { color: var(--accent); flex: none; }
.note-item__star svg { width: 13px; height: 13px; }
.note-item__preview {
  margin-top: 3px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.note-item__meta { margin-top: 8px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.note-item__time { font-size: 11.8px; color: var(--faint); flex: none; }

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-sunk);
  border: 1px solid var(--border-soft);
  font-size: 11.4px;
  font-weight: 540;
  color: var(--muted);
  white-space: nowrap;
}
.tag--accent { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }

mark {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: inherit;
  border-radius: 3px;
  padding: 0 2px;
}

.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}
.empty svg { width: 30px; height: 30px; margin: 0 auto 12px; color: var(--border); }
.empty strong { display: block; color: var(--text); font-size: 15px; font-weight: 600; margin-bottom: 5px; }

/* Editor */

.editor { background: var(--panel); }
.editor__bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  min-height: 53px;
}
.editor__bar-spacer { flex: 1; }
.editor__back { display: none; }

.fmt-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 7px 14px;
  border-bottom: 1px solid var(--border-soft);
  overflow-x: auto;
  scrollbar-width: none;
}
.fmt-bar::-webkit-scrollbar { display: none; }
.fmt-bar__sep { width: 1px; height: 18px; background: var(--border); margin: 0 5px; flex: none; }
.fmt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 28px;
  padding: 0 7px;
  border: 0;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--muted);
  font-size: 12.6px;
  font-weight: 580;
  cursor: pointer;
  flex: none;
  transition: background-color .14s ease, color .14s ease;
}
.fmt-btn:hover { background: var(--bg-sunk); color: var(--text); }
.fmt-btn svg { width: 15px; height: 15px; }

.editor__scroll { flex: 1; overflow-y: auto; }
.editor__doc { width: 100%; max-width: var(--editor-width); margin: 0 auto; padding: 32px 28px 56px; }

.editor__title {
  width: 100%;
  border: 0;
  background: transparent;
  outline: none;
  font-family: var(--font-editor);
  font-size: 30px;
  font-weight: 660;
  letter-spacing: -0.028em;
  line-height: 1.2;
  color: var(--text);
  padding: 0;
}
.editor__title::placeholder { color: var(--faint); }

.editor__tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.editor__tags .tag { padding-right: 5px; gap: 4px; }
.tag__x { border: 0; background: transparent; color: inherit; cursor: pointer; padding: 0 2px; line-height: 1; opacity: .55; }
.tag__x:hover { opacity: 1; }
.tag-add {
  border: 1px dashed var(--border);
  background: transparent;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11.6px;
  font-weight: 540;
  color: var(--faint);
  cursor: pointer;
}
.tag-add:hover { color: var(--accent); border-color: var(--accent-line); }

.editor__body {
  margin-top: 20px;
  outline: none;
  font-family: var(--font-editor);
  font-size: var(--editor-size);
  line-height: 1.72;
  color: var(--text);
  min-height: 260px;
}
.editor__body:empty::before {
  content: attr(data-placeholder);
  color: var(--faint);
}
.editor__body h1 { font-size: 1.55em; margin: 1.1em 0 .4em; font-weight: 660; }
.editor__body h2 { font-size: 1.26em; margin: 1em 0 .35em; font-weight: 640; }
.editor__body p { margin: 0 0 .75em; }
.editor__body ul, .editor__body ol { margin: 0 0 .8em; padding-left: 1.3em; }
.editor__body li { margin-bottom: .28em; }
.editor__body blockquote {
  margin: .8em 0;
  padding: 2px 0 2px 15px;
  border-left: 3px solid var(--accent-line);
  color: var(--muted);
  font-style: italic;
}
.editor__body pre, .editor__body code {
  font-family: var(--font-mono);
  font-size: .9em;
}
.editor__body pre {
  background: var(--bg-sunk);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  overflow-x: auto;
  margin: .8em 0;
}
.editor__body hr { border: 0; border-top: 1px solid var(--border); margin: 1.6em 0; }
.editor__body a { color: var(--accent); }

.editor__body ul.checklist { list-style: none; padding-left: 2px; }
.editor__body ul.checklist li { display: flex; align-items: flex-start; gap: 9px; }
.editor__body ul.checklist input { margin-top: .42em; accent-color: var(--accent); flex: none; }
.editor__body ul.checklist li.done { color: var(--faint); text-decoration: line-through; }

.notelink {
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 5px;
  padding: 1px 5px;
  cursor: pointer;
  font-weight: 540;
  white-space: nowrap;
}
.notelink:hover { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.notelink--missing { color: var(--faint); background: var(--bg-sunk); }

.doc-foot { margin-top: 34px; padding-top: 20px; border-top: 1px solid var(--border-soft); }
.doc-stats { display: flex; gap: 22px; flex-wrap: wrap; }
.doc-stat__k { font-size: 10.8px; font-weight: 640; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); }
.doc-stat__v { font-size: 13.6px; font-weight: 560; margin-top: 2px; }

.backlinks { margin-top: 26px; }
.backlinks__head { display: flex; align-items: center; gap: 8px; }
.backlinks__title { font-size: 10.8px; font-weight: 660; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); }
.backlinks__count { margin-top: 6px; font-size: 13.4px; color: var(--muted); }
.backlinks__list { margin-top: 10px; display: grid; gap: 6px; }
.backlink {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--panel-alt);
  cursor: pointer;
  font-size: 13.6px;
  font-weight: 530;
  transition: border-color .14s ease, background-color .14s ease;
}
.backlink:hover { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }
.backlink svg { width: 14px; height: 14px; color: var(--faint); flex: none; }
.backlink:hover svg { color: var(--accent); }

/* ---------------- Overlays ---------------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  padding: 24px;
}
.overlay.is-open { display: block; }
.overlay__scrim {
  position: absolute;
  inset: 0;
  background: rgba(12, 14, 24, .46);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }

.panel {
  position: relative;
  width: 100%;
  max-width: 880px;
  max-height: calc(100vh - 48px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  animation: rise .2s cubic-bezier(.2, .8, .3, 1);
}
.panel--wide { max-width: 1120px; }
.panel--tall { height: calc(100vh - 48px); }

.panel__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  flex: none;
}
.panel__titles { flex: 1; min-width: 0; }
.panel__title { font-size: 17.5px; font-weight: 640; display: flex; align-items: center; gap: 9px; }
.panel__sub { margin-top: 3px; font-size: 13.6px; color: var(--muted); }
.panel__body { flex: 1; overflow-y: auto; padding: 22px; }
.panel__foot { flex: none; padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 9px; flex-wrap: wrap; }
.panel__body--flush { padding: 0; display: flex; flex-direction: column; overflow: hidden; }

/* Command palette */

.palette {
  max-width: 620px;
  margin: 8vh auto 0;
  animation: rise .18s cubic-bezier(.2, .8, .3, 1);
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
}
.palette__input-row { display: flex; align-items: center; gap: 11px; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.palette__input-row svg { width: 17px; height: 17px; color: var(--faint); flex: none; }
.palette__input { flex: 1; border: 0; background: transparent; outline: none; font-size: 16.5px; }
.palette__input::placeholder { color: var(--faint); }
.palette__list { max-height: 340px; overflow-y: auto; padding: 7px; }
.palette__group { font-size: 10.6px; font-weight: 660; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); padding: 9px 11px 5px; }
.palette__item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 11px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-size: 14.2px;
  font-weight: 520;
  color: var(--text);
}
.palette__item:hover, .palette__item.is-cursor { background: var(--accent-soft); color: var(--accent); }
.palette__item svg { width: 16px; height: 16px; color: var(--faint); flex: none; }
.palette__item:hover svg, .palette__item.is-cursor svg { color: var(--accent); }
.palette__item-main { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette__item-sub { font-size: 12.4px; color: var(--faint); flex: none; }
.palette__foot { padding: 9px 16px; border-top: 1px solid var(--border); display: flex; gap: 14px; font-size: 11.8px; color: var(--faint); flex-wrap: wrap; }

/* Generic grids inside panels */

.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 13px; }

.card-tile {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--panel-alt);
  padding: 17px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 7px;
  cursor: pointer;
  transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.card-tile:hover { border-color: var(--accent-line); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.card-tile__icon {
  width: 34px; height: 34px;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 3px;
}
.card-tile__icon svg { width: 17px; height: 17px; }
.card-tile h4 { font-size: 14.6px; font-weight: 610; }
.card-tile p { font-size: 13px; color: var(--muted); line-height: 1.5; flex: 1; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat-box {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--panel-alt);
  padding: 15px 16px;
}
.stat-box__k { font-size: 12.6px; color: var(--muted); font-weight: 520; }
.stat-box__v { font-size: 26px; font-weight: 660; letter-spacing: -0.03em; margin-top: 3px; font-variant-numeric: tabular-nums; }

.block-title { font-size: 11px; font-weight: 660; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin: 26px 0 12px; }
.block-title:first-child { margin-top: 0; }

.bar-row { display: grid; grid-template-columns: minmax(84px, 132px) 1fr auto; gap: 12px; align-items: center; margin-bottom: 9px; font-size: 13.4px; }
.bar-row__label { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row__track { height: 9px; border-radius: 999px; background: var(--bg-sunk); overflow: hidden; }
.bar-row__fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-hover)); transition: width .5s cubic-bezier(.4, 0, .2, 1); }
.bar-row__val { font-size: 12.6px; color: var(--faint); font-variant-numeric: tabular-nums; }

.rule-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; }
.field { display: grid; gap: 5px; min-width: 0; }
.field label { font-size: 11.4px; font-weight: 620; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.field input, .field select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg);
  font-size: 13.8px;
  outline: none;
}
.field input:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-line); }

.chip-row { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  padding: 6px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  font-size: 13px;
  font-weight: 530;
  color: var(--muted);
  cursor: pointer;
  transition: all .14s ease;
}
.chip:hover { border-color: var(--accent-line); color: var(--text); }
.chip.is-on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }

.result-row {
  display: block;
  width: 100%;
  text-align: left;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--panel-alt);
  cursor: pointer;
  margin-bottom: 8px;
  transition: border-color .14s ease;
}
.result-row:hover { border-color: var(--accent-line); }
.result-row__title { font-size: 14.4px; font-weight: 590; }
.result-row__snippet { margin-top: 4px; font-size: 13px; color: var(--muted); line-height: 1.55; }
.result-row__meta { margin-top: 8px; display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }

.collection-block { border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; margin-bottom: 12px; }
.collection-block__head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 15px;
  background: var(--panel-alt);
  border-bottom: 1px solid var(--border);
}
.collection-block__name { font-size: 14.4px; font-weight: 610; flex: 1; }
.collection-block__rule { font-size: 12.4px; color: var(--faint); }
.collection-block__body { padding: 9px; }

/* Knowledge graph */

.graph-wrap { position: relative; flex: 1; min-height: 0; background: var(--bg-sunk); }
#graphCanvas { width: 100%; height: 100%; display: block; cursor: grab; }
#graphCanvas.is-dragging { cursor: grabbing; }
.graph-controls {
  position: absolute;
  right: 16px;
  bottom: 16px;
  display: flex;
  gap: 6px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
}
.graph-legend {
  position: absolute;
  left: 16px;
  bottom: 16px;
  padding: 11px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  font-size: 12.4px;
  color: var(--muted);
  max-width: 260px;
}
.graph-legend b { color: var(--text); font-weight: 600; }
.graph-tip {
  position: absolute;
  pointer-events: none;
  padding: 6px 11px;
  background: var(--text);
  color: var(--bg);
  border-radius: var(--r-xs);
  font-size: 12.4px;
  font-weight: 540;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, -140%);
  transition: opacity .12s ease;
}
.graph-tip.is-on { opacity: 1; }

/* Focus mode */

.focus {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: none;
  flex-direction: column;
  background: var(--bg);
}
.focus.is-open { display: flex; }
.focus__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 22px;
  flex-wrap: wrap;
  opacity: .45;
  transition: opacity .22s ease;
}
.focus__bar:hover, .focus__bar:focus-within { opacity: 1; }
.focus__spacer { flex: 1; }
.focus__scroll { flex: 1; overflow-y: auto; }
.focus__doc { max-width: var(--editor-width); margin: 0 auto; padding: 5vh 26px 22vh; }
.focus__title {
  width: 100%; border: 0; background: transparent; outline: none;
  font-family: var(--font-editor);
  font-size: clamp(30px, 4vw, 40px);
  font-weight: 660;
  letter-spacing: -0.03em;
}
.focus__body {
  margin-top: 22px;
  outline: none;
  font-family: var(--font-editor);
  font-size: calc(var(--editor-size) + 2px);
  line-height: 1.85;
}
.focus__meta {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  justify-content: center;
  gap: 26px;
  padding: 14px;
  font-size: 12.8px;
  color: var(--faint);
  background: linear-gradient(to top, var(--bg) 55%, transparent);
  pointer-events: none;
  flex-wrap: wrap;
}
.focus__meta b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.focus__timer.is-done b { color: var(--accent); }

/* Toast */

.toast-stack { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; width: min(420px, calc(100vw - 32px)); }
.toast {
  padding: 11px 16px;
  border-radius: var(--r-sm);
  background: var(--text);
  color: var(--bg);
  font-size: 13.6px;
  font-weight: 520;
  box-shadow: var(--shadow-lg);
  animation: rise .2s cubic-bezier(.2, .8, .3, 1);
}

/* ---------------- Marketing sections ---------------- */

.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.feature {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--panel);
  padding: 24px 22px;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.feature:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--accent-line); }
.feature__icon {
  width: 38px; height: 38px;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 14px;
}
.feature__icon svg { width: 18px; height: 18px; }
.feature h3 { font-size: 16px; font-weight: 620; display: flex; align-items: center; gap: 8px; }
.feature p { margin-top: 7px; font-size: 14.4px; color: var(--muted); }

/* Pro showcase */

.pro-hero {
  border-radius: var(--r-xl);
  padding: 54px 46px;
  color: #f2f3f9;
  background:
    radial-gradient(760px 340px at 86% -12%, rgba(139, 140, 245, .34), transparent 62%),
    radial-gradient(560px 300px at 0% 110%, rgba(79, 192, 164, .18), transparent 60%),
    linear-gradient(155deg, #1a1b28, #16172180 52%, #101119);
  background-color: #14151d;
  box-shadow: var(--shadow-lg);
}
.pro-hero__head { max-width: 620px; }
.pro-hero .eyebrow { color: #a9aaf8; }
.pro-hero h2 { color: #fff; font-size: clamp(26px, 3.2vw, 37px); }
.pro-hero__sub { margin-top: 13px; font-size: 16.8px; color: rgba(255, 255, 255, .66); }

.showcase { margin-top: 42px; display: grid; gap: 18px; }
.showcase__item {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 32px;
  align-items: center;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, .04);
}
.showcase__num { font-size: 12.5px; font-weight: 680; letter-spacing: .16em; color: #a9aaf8; }
.showcase__item h3 { margin-top: 9px; font-size: 21px; color: #fff; }
.showcase__item p { margin-top: 9px; font-size: 15px; color: rgba(255, 255, 255, .64); line-height: 1.6; }
.showcase__visual {
  border-radius: var(--r-md);
  border: 1px solid rgba(255, 255, 255, .1);
  background: rgba(0, 0, 0, .26);
  min-height: 208px;
  padding: 16px;
  overflow: hidden;
  position: relative;
}
.showcase__visual svg { width: 100%; height: 100%; }

.mini-rule {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .08);
  font-size: 12.8px;
  color: rgba(255, 255, 255, .72);
  margin-bottom: 8px;
}
.mini-rule b { color: #fff; font-weight: 600; }
.mini-rule__tag {
  margin-left: auto;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(139, 140, 245, .2);
  color: #b9baff;
  font-size: 11.2px;
  font-weight: 600;
}
.mini-link {
  display: flex; align-items: center; gap: 9px;
  font-size: 12.8px; color: rgba(255, 255, 255, .74);
  padding: 8px 0;
}
.mini-link span.dot { width: 7px; height: 7px; border-radius: 50%; background: #8b8cf5; flex: none; }
.mini-link em { font-style: normal; color: rgba(255, 255, 255, .45); margin-left: auto; font-size: 11.6px; }

@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.g-node { animation: floaty 5s ease-in-out infinite; }
.g-node:nth-child(2) { animation-delay: -1.2s; }
.g-node:nth-child(3) { animation-delay: -2.4s; }
.g-node:nth-child(4) { animation-delay: -3.6s; }
.g-node:nth-child(5) { animation-delay: -0.6s; }

/* Pricing */

.plans { display: grid; grid-template-columns: minmax(0, .86fr) minmax(0, 1.14fr); gap: 22px; align-items: start; max-width: 1020px; margin: 0 auto; }
.plan {
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--panel);
  padding: 30px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}
.plan--pro {
  border-color: var(--accent-line);
  box-shadow: var(--shadow-lg);
  position: relative;
  background: linear-gradient(180deg, var(--accent-soft), transparent 190px), var(--panel);
}
.plan__flag {
  position: absolute; top: 22px; right: 24px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 10.8px;
  font-weight: 680;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.plan__name { font-size: 15px; font-weight: 640; }
.plan__desc { margin-top: 5px; font-size: 14px; color: var(--muted); }
.plan__price { margin-top: 20px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.plan__amount { font-size: 40px; font-weight: 680; letter-spacing: -0.035em; }
.plan__period { font-size: 14.4px; color: var(--muted); }
.plan__alt { margin-top: 6px; font-size: 13.4px; color: var(--faint); display: flex; align-items: center; gap: 9px; flex-wrap: wrap; min-height: 22px; }
.best-value {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--good-soft);
  color: var(--good);
  font-size: 10.6px;
  font-weight: 680;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.plan ul { list-style: none; margin: 22px 0 26px; padding: 0; display: grid; align-content: start; gap: 10px; flex: 1; }
.plan li { display: flex; gap: 10px; align-items: flex-start; font-size: 14.2px; color: var(--muted); }
.plan li svg { width: 16px; height: 16px; flex: none; margin-top: 3px; color: var(--accent); }
.plan li b { color: var(--text); font-weight: 590; display: block; }
.plan li i { font-style: normal; display: block; font-size: 13.2px; margin-top: 1px; }
.plan--free li svg { color: var(--good); }
.pricing-note {
  max-width: 700px;
  margin: 28px auto 0;
  text-align: center;
  font-size: 13.8px;
  color: var(--muted);
}
.pricing-note span { display: block; margin-top: 8px; color: var(--faint); font-size: 13.2px; }

/* About / FAQ / footer */

.about { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 40px; align-items: start; }
.about p { color: var(--muted); font-size: 16.4px; }
.about p + p { margin-top: 15px; }
.about__card { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--panel); padding: 24px; box-shadow: var(--shadow-sm); }
.about__row + .about__row { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.about__k { font-size: 11.4px; font-weight: 640; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.about__v { margin-top: 3px; font-size: 15px; font-weight: 550; }
.about__v a { color: var(--accent); }
.about__v a:hover { text-decoration: underline; }

.faq { max-width: 760px; margin: 0 auto; display: grid; gap: 10px; }
.faq details { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--panel); overflow: hidden; box-shadow: var(--shadow-sm); }
.faq summary {
  list-style: none; cursor: pointer;
  padding: 16px 20px;
  font-size: 15.4px; font-weight: 570;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary svg { width: 17px; height: 17px; color: var(--faint); flex: none; transition: transform .18s ease; }
.faq details[open] summary svg { transform: rotate(45deg); }
.faq p { padding: 0 20px 18px; color: var(--muted); font-size: 14.6px; }

.footer { border-top: 1px solid var(--border); background: var(--bg-sunk); padding: 52px 0 30px; }
.footer__grid { display: grid; grid-template-columns: minmax(0, 1.5fr) repeat(2, minmax(0, 1fr)); gap: 34px; }
.footer__about { max-width: 320px; }
.footer__about p { margin-top: 12px; font-size: 14.2px; color: var(--muted); }
.footer h4 { font-size: 11.4px; font-weight: 640; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin-bottom: 12px; }
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.footer li a { font-size: 14.2px; color: var(--muted); }
.footer li a:hover { color: var(--text); }
.footer__bottom {
  margin-top: 36px; padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-size: 13.2px; color: var(--faint);
}

/* Legal pages */

.legal { padding: 58px 0 84px; }
.legal__inner { max-width: 760px; margin: 0 auto; }
.legal__back { display: inline-flex; align-items: center; gap: 7px; font-size: 13.8px; color: var(--muted); font-weight: 520; margin-bottom: 24px; }
.legal__back:hover { color: var(--text); }
.legal__back svg { width: 15px; height: 15px; }
.legal h1 { font-size: clamp(29px, 4vw, 39px); }
.legal__updated { margin-top: 11px; color: var(--faint); font-size: 13.8px; }
.legal h2 { font-size: 19.5px; margin-top: 38px; }
.legal p { margin-top: 13px; color: var(--muted); font-size: 15.8px; }
.legal ul { margin-top: 13px; padding-left: 20px; color: var(--muted); font-size: 15.8px; }
.legal li { margin-bottom: 7px; }
.legal a { color: var(--accent); }
.legal a:hover { text-decoration: underline; }

/* ---------------- Responsive ---------------- */

@media (max-width: 1180px) {
  .workspace { --sidebar-w: 216px; --list-w: 300px; }
  .showcase__item { grid-template-columns: 1fr; gap: 22px; }
  .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .about { grid-template-columns: 1fr; gap: 26px; }
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
    min-height: 0;
  }
  .ws-col + .ws-col { border-left: 0; border-top: 1px solid var(--border); }

  .sidebar {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    width: 272px;
    z-index: 130;
    border-right: 1px solid var(--border);
    transform: translateX(-102%);
    transition: transform .24s cubic-bezier(.2, .8, .3, 1);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.is-open { transform: none; }
  .sidebar-scrim.is-open { display: block; }

  .ws-list { height: 62vh; }
  .ws-editor { height: 78vh; }
  .ws-list.is-hidden-mobile, .ws-editor.is-hidden-mobile { display: none; }
  .editor__back { display: inline-flex; }
  .plans { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .nav__links { display: none; }
  .nav__toggle { display: inline-flex; }
  .section { padding: 62px 0; }
  .pro-hero { padding: 36px 22px; }
  .footer__grid { grid-template-columns: 1fr 1fr; }
  .footer__about { grid-column: 1 / -1; max-width: none; }
}

@media (max-width: 620px) {
  .wrap { padding: 0 16px; }
  .hero { padding: 52px 0 44px; }
  .feature-grid { grid-template-columns: 1fr; }
  .workspace { border-radius: var(--r-lg); }
  .editor__doc { padding: 22px 18px 44px; }
  .editor__title { font-size: 25px; }
  .panel { border-radius: var(--r-lg); max-height: calc(100vh - 24px); }
  .overlay { padding: 12px; }
  .palette { margin-top: 4vh; }
  .panel__head, .panel__body, .panel__foot { padding-inline: 16px; }
  .rule-form { grid-template-columns: 1fr; }
  .plan { padding: 24px 20px; }
  .grid-cards { grid-template-columns: 1fr; }
  .nav__cta-full { display: none; }
  .hero__cta .btn { flex: 1 1 100%; }
  .graph-legend { display: none; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bar-row { grid-template-columns: minmax(70px, 96px) 1fr auto; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* Ghost buttons sit on the dark Pro panel, so they need their own palette. */
.pro-hero .btn--ghost {
  background: rgba(255, 255, 255, .1);
  border-color: rgba(255, 255, 255, .2);
  color: #fff;
  box-shadow: none;
}
.pro-hero .btn--ghost:hover {
  background: rgba(255, 255, 255, .17);
  border-color: rgba(255, 255, 255, .32);
}

/* ---------------- Full-screen app mode ---------------- */

.workspace-section { padding-bottom: 78px; }

/* The exit control only makes sense once the workspace has taken over the screen. */
.app-exit { display: none; }
body.is-app .app-exit { display: inline-flex; }

body.is-app { overflow: hidden; }
body.is-app .nav,
body.is-app .nav__mobile { display: none; }

body.is-app .workspace-section {
  padding: 0;
  max-width: none;
}

body.is-app .workspace {
  position: fixed;
  inset: 0;
  z-index: 50;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

/* Everything below the workspace is still in the document; the fixed panel covers it and
   the locked body keeps it from scrolling into view. */
body.is-app main > .section,
body.is-app main > .hero,
body.is-app .footer { visibility: hidden; }

@media (max-width: 980px) {
  /* The fixed-height list and editor exist so the workspace has a sensible size inside the
     page. Filling the screen instead is the whole point of app mode. */
  body.is-app .workspace { display: flex; flex-direction: column; }
  body.is-app .ws-list,
  body.is-app .ws-editor { height: auto; flex: 1 1 auto; min-height: 0; }
}
