:root {
  color-scheme: light;
  --ink: #1d1d1f;
  --muted: #86868b;
  --soft: #f5f5f7;
  --surface: #ffffff;
  --sidebar: rgba(246, 246, 244, 0.86);
  --line: rgba(60, 60, 67, 0.14);
  --line-strong: rgba(60, 60, 67, 0.22);
  --accent: #ffcc33;
  --accent-strong: #f5b700;
  --blue: #0066cc;
  --note-peach: #ffd8cc;
  --note-apricot: #ffe3c2;
  --note-lemon: #ffe79b;
  --note-mint: #d7f4de;
  --note-sage: #deedd0;
  --note-aqua: #d7f2ef;
  --note-sky: #dcebff;
  --note-periwinkle: #dfe2ff;
  --note-lilac: #eadcff;
  --note-rose: #ffd8e6;
  --shadow: 0 22px 80px rgba(0, 0, 0, 0.16);
  --radius: 18px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  display: grid;
  place-items: center;
  margin: 0;
  padding: 14px;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.96), transparent 34%),
    radial-gradient(circle at 84% 10%, rgba(255, 255, 255, 0.92), transparent 30%),
    radial-gradient(circle at 82% 88%, rgba(255, 214, 168, 0.14), transparent 30%),
    linear-gradient(to bottom, #fffdf9 0%, #fffaf3 34%, #fde8d2 100%);
  overflow: hidden;
}

.notebook-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: min(1440px, 100%);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
}

.notebook-shell {
  position: relative;
  display: grid;
  grid-template-areas: "folders notes editor";
  grid-template-columns: 220px 320px minmax(420px, 1fr);
  width: min(1440px, 100%);
  height: min(900px, calc(100vh - 88px));
  margin: 0;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(26px) saturate(1.35);
}

.cross-links {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  padding: 0 6px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.cross-links::-webkit-scrollbar {
  display: none;
}

.cross-links a {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 14px;
  white-space: nowrap;
  color: rgba(29, 29, 31, 0.68);
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(60, 60, 67, 0.12);
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(56, 44, 28, 0.04);
  backdrop-filter: blur(18px) saturate(1.08);
  -webkit-backdrop-filter: blur(18px) saturate(1.08);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}

.cross-links a:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(60, 60, 67, 0.16);
}

.notebook-shell.fullscreen-mode {
  position: fixed;
  inset: 0;
  width: 100vw;
  max-width: none;
  height: 100dvh;
  border-radius: 0;
  border: 0;
  box-shadow: none;
  z-index: 90;
}

.notebook-shell.focus-mode {
  grid-template-areas: "editor";
  grid-template-columns: minmax(0, 1fr);
}

.notebook-shell.folders-collapsed {
  grid-template-areas: "notes editor";
  grid-template-columns: 320px minmax(420px, 1fr);
}

.notebook-shell.folders-collapsed .folders-pane {
  display: none;
}

.notebook-shell.focus-mode .notes-pane,
.notebook-shell.focus-mode .folders-pane {
  display: none;
}

.editor-pane,
.notes-pane,
.folders-pane {
  min-width: 0;
  min-height: 0;
}

.editor-pane {
  grid-area: editor;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}

.notes-pane {
  grid-area: notes;
  display: flex;
  flex-direction: column;
  background: rgba(250, 250, 252, 0.92);
  border-right: 1px solid var(--line);
}

.folders-pane {
  grid-area: folders;
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
}

.topbar,
.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 62px;
  padding: 14px 18px;
}

.topbar {
  display: grid;
  grid-template-columns: 136px minmax(0, 1fr) 136px;
  align-items: center;
  border-bottom: 1px solid rgba(60, 60, 67, 0.08);
}

.window-dots,
.dot {
  display: none !important;
}

.pane-header h1,
.pane-header h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0;
}

.pane-header p,
.note-meta,
.storage-note {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.compact {
  padding-right: 14px;
}

.note-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin: 0;
  text-align: right;
}

.save-check {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  margin-right: 2px;
  color: #ffffff;
  background: #28c840;
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.72);
  transition: opacity 180ms ease, transform 180ms ease;
}

.save-check::after {
  content: "";
  width: 6px;
  height: 3px;
  margin-top: -1px;
  border-bottom: 2px solid currentColor;
  border-left: 2px solid currentColor;
  transform: rotate(-45deg);
}

.save-check.visible {
  opacity: 1;
  transform: scale(1);
}

.toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  width: 136px;
  flex: 0 0 136px;
}

.toolbar-left {
  justify-content: flex-start;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  color: #3a3a3c;
  background: rgba(118, 118, 128, 0.09);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.icon-button:hover {
  background: rgba(118, 118, 128, 0.16);
}

.icon-button:disabled,
.format-button:disabled {
  opacity: 0.42;
  cursor: default;
}

.icon-button:active {
  transform: scale(0.96);
}

.icon-button.active {
  color: #8a6700;
  background: rgba(255, 204, 51, 0.34);
}

.elevated {
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7), 0 10px 28px rgba(0, 0, 0, 0.06);
}

.icon-button svg,
.search-box svg,
.folder-item svg,
.format-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-mask {
  display: block;
  width: 18px;
  height: 18px;
  background: currentColor;
  opacity: 0.72;
  pointer-events: none;
  -webkit-mask: var(--icon-url) center / contain no-repeat;
  mask: var(--icon-url) center / contain no-repeat;
}

.icon-add,
.icon-folder-plus,
.icon-panels,
.icon-pin,
.icon-fullscreen,
.icon-download,
.icon-trash {
  background-color: transparent;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  opacity: 0.9;
  -webkit-mask: none;
  mask: none;
}

.icon-button:hover .icon-mask,
.icon-button.active .icon-mask {
  opacity: 0.88;
}

.icon-add {
  background-image: url("/icons/png/add-note.png");
}

#addNote .icon-add {
  width: 22px;
  height: 22px;
  opacity: 1;
  background-size: 22px 22px;
}

.icon-folder-plus {
  background-image: url("/icons/png/folder-plus.png");
}

.icon-panels {
  background-image: url("/icons/png/sidebar-hide.png?v=20260616-panel-back-forward");
}

#toggleFocus .icon-panels,
.mobile-panel-toggle .icon-panels {
  width: 17px;
  height: 17px;
  opacity: 1;
  background-position: center center;
  background-size: 17px 17px;
}

.icon-pin {
  background-image: url("/icons/png/pin.png");
}

.icon-fullscreen {
  background-image: url("/icons/png/fullscreen-enter.png?v=20260616-fullscreen-icons");
  width: 16px;
  height: 16px;
  background-position: center center;
  background-size: 16px 16px;
  transform: translateX(1px);
}

.icon-download {
  background-image: url("/icons/png/download.png");
}

.icon-trash {
  background-image: url("/icons/png/trash.png");
}

.icon-button.active .icon-panels {
  background-image: url("/icons/png/sidebar-show.png?v=20260616-panel-back-forward");
}

.notebook-shell.mobile-view-editor .mobile-panel-toggle .icon-panels {
  background-image: url("/icons/png/sidebar-hide.png?v=20260616-panel-back-forward");
}

.notebook-shell.mobile-view-notes .mobile-panel-toggle .icon-panels,
.notebook-shell.mobile-view-folders .mobile-panel-toggle .icon-panels,
.notebook-shell:not(.focus-mode) #toggleFocus .icon-panels {
  background-image: url("/icons/png/sidebar-show.png?v=20260616-panel-back-forward");
}

.notebook-shell.focus-mode #toggleFocus .icon-panels {
  background-image: url("/icons/png/sidebar-show.png?v=20260616-panel-back-forward");
}

.notebook-shell.fullscreen-mode #toggleFullscreen .icon-fullscreen {
  background-image: url("/icons/png/fullscreen-exit.png?v=20260616-fullscreen-icons");
}

.mobile-panel-toggle {
  display: none;
}

.title-input {
  width: 100%;
  padding: 26px 34px 10px;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: clamp(28px, 3vw, 42px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: 0;
}

.content-input {
  width: 100%;
  flex: 1;
  padding: 8px 34px 34px;
  color: #2d2d2f;
  background: transparent;
  border: 0;
  outline: 0;
  resize: none;
  overflow: auto;
  font-size: 18px;
  line-height: 1.52;
  letter-spacing: 0;
}

.format-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 46px;
  padding: 6px 28px 8px;
  border-bottom: 1px solid rgba(60, 60, 67, 0.08);
}

.format-bar-header {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 36px;
  padding: 0 18px;
  justify-content: center;
  overflow-x: auto;
  border-bottom: 0;
  scrollbar-width: none;
}

.format-bar-header::-webkit-scrollbar {
  display: none;
}

.format-bar-mobile {
  display: none;
}

.topbar .format-button {
  flex: 0 0 auto;
}

.format-button {
  display: inline-grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  padding: 0 9px;
  color: #3a3a3c;
  background: rgba(118, 118, 128, 0.08);
  border-radius: 8px;
  cursor: pointer;
  line-height: 1;
  transition: background-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.format-button:hover {
  background: rgba(118, 118, 128, 0.15);
}

.format-button:active {
  transform: scale(0.96);
}

.format-button.active {
  color: #8a6700;
  background: rgba(255, 204, 51, 0.34);
}

.text-mode-button {
  min-width: 52px;
  font-size: 12px;
  font-weight: 700;
}

.heading-button {
  min-width: 38px;
  font-size: 12px;
  font-weight: 800;
}

.format-divider {
  width: 1px;
  height: 22px;
  margin: 0 4px;
  background: var(--line);
}

.rich-editor {
  min-height: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.rich-editor:empty::before {
  content: attr(data-placeholder);
  color: rgba(60, 60, 67, 0.38);
}

.rich-editor p,
.rich-editor h2,
.rich-editor h3,
.rich-editor ul,
.rich-editor ol,
.rich-editor blockquote,
.rich-editor pre {
  margin: 0 0 12px;
}

.rich-editor h2 {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.18;
}

.rich-editor h3 {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.22;
}

.rich-editor ul,
.rich-editor ol {
  padding-left: 28px;
}

.rich-editor li {
  margin: 4px 0;
}

.rich-editor ul[data-list="checkpoints"] {
  padding-left: 0;
  list-style: none;
}

.rich-editor ul[data-list="checkpoints"] li {
  position: relative;
  padding-left: 38px;
  list-style: none;
}

.rich-editor ul[data-list="checkpoints"] li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.18em;
  width: 20px;
  height: 20px;
  background: rgba(255, 255, 255, 0.72);
  border: 1.6px solid rgba(60, 60, 67, 0.38);
  border-radius: 50%;
}

.rich-editor ul[data-list="checkpoints"] li[data-checked="true"] {
  color: rgba(31, 31, 36, 0.58);
  text-decoration: line-through;
}

.rich-editor ul[data-list="checkpoints"] li[data-checked="true"]::before {
  background: rgba(255, 214, 107, 0.88);
  border-color: rgba(138, 103, 0, 0.24);
}

.rich-editor ul[data-list="checkpoints"] li[data-checked="true"]::after {
  content: "";
  position: absolute;
  left: 7px;
  top: calc(0.18em + 3px);
  width: 6px;
  height: 10px;
  border-right: 2px solid #1f1f24;
  border-bottom: 2px solid #1f1f24;
  transform: rotate(45deg);
}

.rich-editor blockquote {
  padding-left: 14px;
  color: #5f5f63;
  border-left: 3px solid rgba(255, 204, 51, 0.7);
}

.rich-editor code,
.rich-editor pre {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.html-source {
  display: none;
  min-height: 0;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre;
}

.editor-pane.html-mode .rich-editor {
  display: none;
}

.editor-pane.html-mode .html-source {
  display: block;
}

.note-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 58px;
  padding: 10px 34px 12px;
  background: rgba(250, 250, 252, 0.92);
  border-top: 1px solid rgba(60, 60, 67, 0.12);
}

.note-stats-group {
  display: flex;
  align-items: center;
  gap: 26px;
  min-width: 0;
}

.note-meta-bottom {
  flex: 0 0 auto;
  justify-content: flex-end;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.stat-item {
  display: grid;
  gap: 4px;
  min-width: 86px;
}

.stat-item span {
  color: #3a3a3c;
  font-size: 10px;
  line-height: 1.15;
}

.stat-item strong {
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}

.content-input::placeholder,
.title-input::placeholder,
.search-box input::placeholder {
  color: rgba(60, 60, 67, 0.38);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  margin: 0 14px 10px;
  padding: 0 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 12px;
}

.search-box input {
  width: 100%;
  min-width: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 14px;
}

.note-color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 14px 12px;
}

.note-color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(60, 60, 67, 0.12);
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}

.note-color-swatch:hover {
  transform: scale(1.05);
}

.note-color-swatch:disabled {
  opacity: 0.42;
  cursor: default;
}

.note-color-swatch.active {
  box-shadow: inset 0 0 0 2px rgba(31, 31, 36, 0.6), 0 0 0 4px rgba(90, 109, 242, 0.12);
}

.note-color-swatch.peach { background: var(--note-peach); }
.note-color-swatch.apricot { background: var(--note-apricot); }
.note-color-swatch.lemon { background: var(--note-lemon); }
.note-color-swatch.mint { background: var(--note-mint); }
.note-color-swatch.sage { background: var(--note-sage); }
.note-color-swatch.aqua { background: var(--note-aqua); }
.note-color-swatch.sky { background: var(--note-sky); }
.note-color-swatch.periwinkle { background: var(--note-periwinkle); }

.notes-list,
.folders-list {
  overflow: auto;
  min-height: 0;
  scrollbar-width: thin;
}

.notes-list {
  padding: 0 10px 18px;
}

.note-group-title {
  margin: 18px 6px 8px;
  color: #3a3a3c;
  font-size: 14px;
  font-weight: 700;
}

.note-item {
  width: 100%;
  display: grid;
  gap: 5px;
  padding: 13px 14px;
  color: var(--ink);
  text-align: left;
  background: transparent;
  border-radius: 8px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.note-item:hover {
  background: rgba(255, 255, 255, 0.62);
}

.note-item.active {
  background: linear-gradient(180deg, #ffe99f 0%, #ffe28b 100%);
  border-color: transparent;
}

.note-item.active.note-color-peach { background: linear-gradient(180deg, #ffd8cc 0%, #ffd1c3 100%); }
.note-item.active.note-color-apricot { background: linear-gradient(180deg, #ffe3c2 0%, #ffdcba 100%); }
.note-item.active.note-color-lemon { background: linear-gradient(180deg, #ffe99f 0%, #ffe28b 100%); }
.note-item.active.note-color-mint { background: linear-gradient(180deg, #d7f4de 0%, #cdf0d6 100%); }
.note-item.active.note-color-sage { background: linear-gradient(180deg, #deedd0 0%, #d5e7c4 100%); }
.note-item.active.note-color-aqua { background: linear-gradient(180deg, #d7f2ef 0%, #cdece8 100%); }
.note-item.active.note-color-sky { background: linear-gradient(180deg, #dcebff 0%, #d3e5fd 100%); }
.note-item.active.note-color-periwinkle { background: linear-gradient(180deg, #dfe2ff 0%, #d5d9fd 100%); }

.note-item.active strong,
.note-item.active span {
  color: #2a2a2e;
}

.note-item strong {
  display: block;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-item span {
  display: block;
  overflow: hidden;
  color: rgba(60, 60, 67, 0.68);
  font-size: 13px;
  line-height: 1.24;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folders-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 0 10px;
}

.folder-item {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  color: #303033;
  text-align: left;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
}

.folder-item:hover,
.folder-item.active {
  background: rgba(118, 118, 128, 0.12);
}

.folder-item.active {
  color: #9b7100;
}

.folder-item span {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-item small {
  color: var(--muted);
  font-size: 12px;
}

.storage-note {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: auto 14px 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  white-space: nowrap;
  flex-wrap: nowrap;
}

.storage-label {
  min-width: 0;
  font-size: 11px;
  line-height: 1;
}

.status-dot {
  flex: 0 0 7px;
}

.storage-help {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-left: 2px;
  flex: 0 0 16px;
  outline: none;
}

.storage-help-icon {
  display: block;
  width: 14px;
  height: 14px;
  opacity: 0.68;
  background: center / contain no-repeat url("/icons/png/info.png");
}

.storage-help-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  width: 280px;
  padding: 10px 12px;
  color: #2f2f33;
  font-size: 12px;
  line-height: 1.4;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(60, 60, 67, 0.1);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(31, 33, 36, 0.12);
  opacity: 0;
  pointer-events: none;
  white-space: normal;
  word-break: break-word;
  transform: translateX(-50%) translateY(6px);
  transition: opacity 160ms ease, transform 160ms ease;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.storage-help-tooltip span {
  display: block;
}

.storage-help-tooltip span + span {
  margin-top: 8px;
}

.storage-help:hover .storage-help-tooltip,
.storage-help:focus-visible .storage-help-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #28c840;
  box-shadow: 0 0 0 4px rgba(40, 200, 64, 0.12);
  animation: statusPulse 2.4s ease-in-out infinite;
}

@keyframes statusPulse {
  0%,
  100% {
    box-shadow: 0 0 0 4px rgba(40, 200, 64, 0.12);
    transform: scale(1);
  }

  50% {
    box-shadow: 0 0 0 8px rgba(40, 200, 64, 0.05);
    transform: scale(1.08);
  }
}

@media (prefers-reduced-motion: reduce) {
  .status-dot {
    animation: none;
  }
}

.empty-state {
  display: grid;
  gap: 4px;
  padding: 26px 16px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.empty-state strong {
  color: #4d4d50;
}

body[data-theme="white"] {
  background:
    radial-gradient(circle at 20% 12%, rgba(255, 255, 255, 0.98), transparent 34%),
    radial-gradient(circle at 82% 10%, rgba(255, 255, 255, 0.96), transparent 30%),
    linear-gradient(to bottom, #ffffff 0%, #fcfcfd 46%, #f3f4f6 100%);
}

body[data-theme="white"] .notebook-shell {
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(255, 255, 255, 0.82);
}

body[data-theme="white"] .notes-pane {
  background: rgba(248, 249, 252, 0.94);
}

body[data-theme="white"] .folders-pane {
  background: rgba(244, 245, 247, 0.92);
}

body[data-theme="dark"] {
  color-scheme: dark;
  background:
    radial-gradient(circle at 16% 10%, rgba(76, 54, 24, 0.16), transparent 28%),
    radial-gradient(circle at 82% 86%, rgba(245, 172, 65, 0.14), transparent 30%),
    linear-gradient(to bottom, #121214 0%, #17171a 44%, #2b2118 100%);
}

body[data-theme="dark"] .notebook-shell {
  background: rgba(18, 18, 20, 0.88);
  border-color: rgba(255, 255, 255, 0.07);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.48);
}

body[data-theme="dark"] .editor-pane {
  background: #151518;
}

body[data-theme="dark"] .notes-pane {
  background: rgba(24, 24, 28, 0.94);
  border-right-color: rgba(255, 255, 255, 0.08);
}

body[data-theme="dark"] .folders-pane {
  background: rgba(29, 25, 21, 0.94);
  border-right-color: rgba(255, 255, 255, 0.08);
}

body[data-theme="dark"] .topbar,
body[data-theme="dark"] .format-bar,
body[data-theme="dark"] .note-stats,
body[data-theme="dark"] .storage-note {
  border-color: rgba(255, 255, 255, 0.08);
}

body[data-theme="dark"] .pane-header h1,
body[data-theme="dark"] .pane-header h2,
body[data-theme="dark"] .note-group-title,
body[data-theme="dark"] .title-input,
body[data-theme="dark"] .content-input,
body[data-theme="dark"] .stat-item strong,
body[data-theme="dark"] .empty-state strong {
  color: #f5f5f7;
}

body[data-theme="dark"] .content-input,
body[data-theme="dark"] .search-box input {
  color: rgba(245, 245, 247, 0.94);
}

body[data-theme="dark"] .content-input::placeholder,
body[data-theme="dark"] .title-input::placeholder,
body[data-theme="dark"] .search-box input::placeholder,
body[data-theme="dark"] .pane-header p,
body[data-theme="dark"] .note-meta,
body[data-theme="dark"] .storage-note,
body[data-theme="dark"] .folder-item small,
body[data-theme="dark"] .empty-state,
body[data-theme="dark"] .note-item span {
  color: rgba(235, 235, 245, 0.58);
}

body[data-theme="dark"] .stat-item span,
body[data-theme="dark"] .storage-label {
  color: rgba(235, 235, 245, 0.72);
}

body[data-theme="dark"] .search-box {
  color: rgba(235, 235, 245, 0.54);
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
}

body[data-theme="dark"] .icon-button,
body[data-theme="dark"] .format-button {
  color: #f5f5f7;
  background: rgba(255, 255, 255, 0.08);
}

body[data-theme="dark"] .icon-button:hover,
body[data-theme="dark"] .format-button:hover {
  background: rgba(255, 255, 255, 0.14);
}

body[data-theme="dark"] .icon-button.active,
body[data-theme="dark"] .format-button.active {
  color: #ffd56b;
  background: rgba(255, 204, 51, 0.24);
}

body[data-theme="dark"] .elevated {
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.24);
}

body[data-theme="dark"] .format-divider {
  background: rgba(255, 255, 255, 0.1);
}

body[data-theme="dark"] .rich-editor:empty::before {
  color: rgba(235, 235, 245, 0.34);
}

body[data-theme="dark"] .rich-editor blockquote {
  color: rgba(245, 245, 247, 0.72);
  border-left-color: rgba(255, 204, 51, 0.55);
}

body[data-theme="dark"] .rich-editor ul[data-list="checkpoints"] li::before {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.34);
}

body[data-theme="dark"] .rich-editor ul[data-list="checkpoints"] li[data-checked="true"] {
  color: rgba(245, 245, 247, 0.5);
}

body[data-theme="dark"] .rich-editor ul[data-list="checkpoints"] li[data-checked="true"]::before {
  background: rgba(255, 214, 107, 0.78);
  border-color: rgba(255, 214, 107, 0.14);
}

body[data-theme="dark"] .note-stats {
  background: rgba(22, 22, 24, 0.96);
}

body[data-theme="dark"] .note-item {
  color: #f5f5f7;
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

body[data-theme="dark"] .note-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

body[data-theme="dark"] .note-item.active {
  background: linear-gradient(180deg, rgba(255, 210, 110, 0.22) 0%, rgba(255, 184, 61, 0.22) 100%);
}

body[data-theme="dark"] .note-item.active.note-color-peach { background: linear-gradient(180deg, #ffd8cc 0%, #ffd1c3 100%); }
body[data-theme="dark"] .note-item.active.note-color-apricot { background: linear-gradient(180deg, #ffe3c2 0%, #ffdcba 100%); }
body[data-theme="dark"] .note-item.active.note-color-lemon { background: linear-gradient(180deg, #ffe99f 0%, #ffe28b 100%); }
body[data-theme="dark"] .note-item.active.note-color-mint { background: linear-gradient(180deg, #d7f4de 0%, #cdf0d6 100%); }
body[data-theme="dark"] .note-item.active.note-color-sage { background: linear-gradient(180deg, #deedd0 0%, #d5e7c4 100%); }
body[data-theme="dark"] .note-item.active.note-color-aqua { background: linear-gradient(180deg, #d7f2ef 0%, #cdece8 100%); }
body[data-theme="dark"] .note-item.active.note-color-sky { background: linear-gradient(180deg, #dcebff 0%, #d3e5fd 100%); }
body[data-theme="dark"] .note-item.active.note-color-periwinkle { background: linear-gradient(180deg, #dfe2ff 0%, #d5d9fd 100%); }

body[data-theme="dark"] .note-item.active strong,
body[data-theme="dark"] .note-item.active span {
  color: #232327;
}

body[data-theme="dark"] .folder-item {
  color: rgba(245, 245, 247, 0.94);
}

body[data-theme="dark"] .folder-item:hover,
body[data-theme="dark"] .folder-item.active {
  background: rgba(255, 255, 255, 0.08);
}

body[data-theme="dark"] .folder-item.active {
  color: #ffd56b;
}

body[data-theme="dark"] .storage-help-tooltip {
  color: rgba(245, 245, 247, 0.92);
  background: rgba(24, 24, 28, 0.96);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.42);
}

body[data-theme="dark"] .cross-links a {
  color: rgba(245, 245, 247, 0.7);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
}

body[data-theme="dark"] .cross-links a:hover {
  color: #f5f5f7;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.12);
}

body[data-theme="dark"] .storage-help-icon {
  opacity: 0.86;
  filter: invert(1);
}

body[data-theme="dark"] .format-button svg path,
body[data-theme="dark"] .search-box svg path,
body[data-theme="dark"] .folder-item svg path {
  stroke: currentColor;
}

body[data-theme="dark"] .icon-mask {
  opacity: 0.92;
}

body[data-theme="dark"] .icon-add,
body[data-theme="dark"] .icon-folder-plus,
body[data-theme="dark"] .icon-panels,
body[data-theme="dark"] .icon-pin,
body[data-theme="dark"] .icon-fullscreen,
body[data-theme="dark"] .icon-download,
body[data-theme="dark"] .icon-trash {
  filter: invert(1) brightness(1.12) contrast(1.08);
}

body[data-theme="dark"] .mobile-panel-toggle,
body[data-theme="dark"] .topbar .toolbar:not(.toolbar-left),
body[data-theme="dark"] .editor-pane .format-bar-mobile {
  background:
    linear-gradient(180deg, rgba(45, 45, 50, 0.42), rgba(24, 24, 27, 0.22)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  border-color: rgba(255, 255, 255, 0.1);
}

body[data-theme="dark"] .topbar .icon-button,
body[data-theme="dark"] .pane-header .icon-button,
body[data-theme="dark"] .editor-pane .format-button {
  color: rgba(245, 245, 247, 0.96);
}

body[data-theme="dark"] .topbar .toolbar:not(.toolbar-left) .icon-button {
  background: transparent;
}

@media (min-width: 721px) and (max-width: 980px) {
  body {
    padding: 18px;
  }

  .notebook-page {
    width: min(1200px, 100%);
  }

  .notebook-shell {
    grid-template-columns: 168px 256px minmax(0, 1fr);
    width: min(1200px, 100%);
    height: min(900px, calc(100dvh - 36px));
  }

  .notebook-shell.folders-collapsed {
    grid-template-columns: 256px minmax(0, 1fr);
  }

  .topbar {
    grid-template-columns: 56px minmax(0, 1fr) 112px;
    gap: 12px;
    padding: 12px 14px;
  }

  .toolbar {
    width: 112px;
    flex: 0 0 112px;
    gap: 6px;
  }

  .toolbar-left {
    width: 56px;
    flex: 0 0 56px;
    justify-content: flex-start;
  }

  .format-bar-header {
    padding: 0 8px;
    gap: 4px;
  }

  .pane-header {
    gap: 12px;
    min-height: 58px;
    padding: 12px 14px;
  }

  .search-box {
    margin: 0 12px 10px;
  }

  .note-color-picker {
    gap: 8px;
    padding: 0 12px 12px;
  }

  .folders-list {
    padding: 0 8px;
  }

  .notes-list {
    padding: 0 8px 16px;
  }

  .title-input {
    padding: 22px 22px 10px;
    font-size: clamp(24px, 4vw, 34px);
  }

  .content-input {
    padding: 8px 22px 24px;
    font-size: 17px;
  }
}

@media (max-width: 720px) {
  .topbar {
    display: flex;
    gap: 10px;
    padding: 12px 14px 12px 58px;
    background: transparent;
    border-bottom: 1px solid rgba(60, 60, 67, 0.08);
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  #toggleFullscreen {
    display: none;
  }

  .pane-header {
    gap: 10px;
    padding: 12px 14px 12px 58px;
  }

  body {
    display: block;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .notebook-page {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .notebook-shell {
    grid-template-areas: "editor";
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    width: 100%;
    max-width: 100%;
    min-height: 100dvh;
    height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
    overflow-x: hidden;
  }

  .mobile-panel-toggle {
    position: absolute;
    z-index: 50;
    top: 14px;
    left: 14px;
    display: grid;
  }

  .toolbar-left {
    display: none;
  }

  .notebook-shell.focus-mode {
    grid-template-areas: "editor";
    grid-template-rows: minmax(100vh, 1fr);
  }

  .notebook-shell.mobile-view-editor {
    grid-template-areas: "editor";
  }

  .notebook-shell.mobile-view-notes {
    grid-template-areas: "notes";
  }

  .notebook-shell.mobile-view-folders {
    grid-template-areas: "folders";
  }

  .notebook-shell.mobile-view-editor .notes-pane,
  .notebook-shell.mobile-view-editor .folders-pane,
  .notebook-shell.mobile-view-notes .editor-pane,
  .notebook-shell.mobile-view-notes .folders-pane,
  .notebook-shell.mobile-view-folders .editor-pane,
  .notebook-shell.mobile-view-folders .notes-pane {
    display: none;
  }

  .editor-pane,
  .notes-pane,
  .folders-pane {
    max-width: 100%;
    overflow-x: hidden;
    border-right: 0;
    border-bottom: 0;
  }

  .folders-pane {
    min-height: 0;
  }

  .toolbar {
    width: auto;
    flex-basis: auto;
    gap: 6px;
    margin-left: auto;
  }

  .topbar .toolbar:not(.toolbar-left) {
    padding: 4px 6px;
    gap: 2px;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(247, 248, 251, 0.18)),
      linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(255, 255, 255, 0.34);
    border-radius: 999px;
    box-shadow:
      0 12px 26px rgba(56, 44, 28, 0.05),
      0 4px 10px rgba(31, 33, 36, 0.03),
      inset 0 1px 0 rgba(255, 255, 255, 0.42),
      inset 0 -1px 0 rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(28px) saturate(1.12);
    -webkit-backdrop-filter: blur(28px) saturate(1.12);
  }

  .format-bar-header {
    display: none;
  }

  .pane-header > div {
    min-width: 0;
    flex: 1 1 auto;
  }

  .pane-header h1,
  .pane-header h2,
  .pane-header p {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .pane-header .icon-button,
  .topbar .icon-button {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.32);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.36),
      inset 0 -1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(18px) saturate(1.04);
    -webkit-backdrop-filter: blur(18px) saturate(1.04);
  }

  .topbar .icon-button:hover,
  .pane-header .icon-button:hover {
    background: rgba(255, 255, 255, 0.24);
  }

  .topbar .toolbar:not(.toolbar-left) .icon-button {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    background: transparent;
    border: 0;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .topbar .toolbar:not(.toolbar-left) .icon-button:hover {
    background: rgba(255, 255, 255, 0.18);
  }

  .editor-pane {
    position: relative;
    min-height: 100dvh;
    overflow: hidden;
  }

  .editor-pane .format-bar-mobile {
    display: inline-flex;
    position: fixed;
    z-index: 40;
    left: 50%;
    right: auto;
    bottom: max(22px, calc(env(safe-area-inset-bottom) + 8px));
    width: auto;
    max-width: calc(100vw - 32px - env(safe-area-inset-left) - env(safe-area-inset-right));
    justify-content: center;
    flex-wrap: nowrap;
    gap: 1px;
    min-height: 58px;
    padding: 8px 10px;
    overflow-x: hidden;
    transform: translateX(-50%);
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(247, 248, 251, 0.18)),
      linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(255, 255, 255, 0.34);
    border-radius: 999px;
    box-shadow:
      0 18px 38px rgba(56, 44, 28, 0.05),
      0 6px 16px rgba(31, 33, 36, 0.03),
      inset 0 1px 0 rgba(255, 255, 255, 0.42),
      inset 0 -1px 0 rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(28px) saturate(1.12);
    -webkit-backdrop-filter: blur(28px) saturate(1.12);
    scrollbar-width: none;
  }

  .editor-pane .format-bar-mobile::-webkit-scrollbar {
    display: none;
  }

  .editor-pane .format-button {
    flex: 0 0 auto;
    min-width: 36px;
    height: 40px;
    padding: 0 8px;
    color: rgba(20, 20, 22, 0.94);
    background: rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.36),
      inset 0 -1px 0 rgba(255, 255, 255, 0.08);
  }

  .editor-pane .format-button:hover {
    background: rgba(255, 255, 255, 0.28);
  }

  .editor-pane .format-button.active {
    color: #8a6700;
    background: rgba(255, 214, 120, 0.32);
  }

  .editor-pane .text-mode-button {
    min-width: 50px;
    font-size: 12px;
  }

  .editor-pane .heading-button {
    min-width: 40px;
    font-size: 12px;
    font-weight: 700;
  }

  .editor-pane .format-divider {
    flex: 0 0 1px;
    height: 22px;
    margin: 0 2px;
    background: rgba(60, 60, 67, 0.1);
  }

  .editor-pane .content-input {
    padding-bottom: calc(132px + env(safe-area-inset-bottom));
  }

  .editor-pane .note-stats {
    display: none;
  }

  .cross-links {
    padding: 0 14px 12px;
  }
}

@media (max-width: 560px) {
  .topbar {
    padding: 12px 14px 12px 58px;
  }

  .pane-header {
    padding: 12px 14px 12px 58px;
  }

  .topbar,
  .pane-header {
    padding-left: 58px;
  }

  .pane-header {
    padding-left: 58px;
  }

  .title-input {
    padding: 18px 20px 14px;
    font-size: 30px;
    text-align: left;
  }

  .content-input {
    padding: 6px 20px 24px;
    font-size: 17px;
  }

  .note-stats {
    gap: 14px;
    padding: 10px 20px 12px;
  }

  .stat-item {
    min-width: 0;
  }

  .stat-item span {
    font-size: 12px;
  }

  .editor-pane .note-stats {
    display: none;
  }
}
