:root {
  color-scheme: light;
  --bg: #fbfaf7;
  --paper: #ffffff;
  --paper-soft: #f6f3ed;
  --sidebar: #f4efe7;
  --inspector: #faf7f1;
  --text: #24211c;
  --muted: #7b746b;
  --faint: #aaa197;
  --line: rgba(56, 48, 38, 0.1);
  --line-strong: rgba(56, 48, 38, 0.18);
  --glow: rgba(246, 183, 60, 0.16);
  --accent: #f6b73c;
  --accent-ink: #34230a;
  --blue: #2f7dd1;
  --red: #d94b57;
  --shadow: 0 18px 58px rgba(90, 74, 48, 0.12);
  --radius: 10px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111424;
  --paper: #1b2034;
  --paper-soft: #242a44;
  --sidebar: #151a2d;
  --inspector: #171d31;
  --text: #f7f2e8;
  --muted: #b7b1c7;
  --faint: #7e7894;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);
  --accent: #ffcf5c;
  --accent-ink: #2b2109;
  --blue: #86ccff;
  --red: #ff7f98;
  --glow: rgba(255, 207, 92, 0.18);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--bg) 96%, #fff2b8), var(--bg));
  color: var(--text);
  font-family: var(--font);
  letter-spacing: 0;
}

body::before,
body::after {
  pointer-events: none;
  position: fixed;
  z-index: 0;
  color: color-mix(in srgb, var(--accent) 42%, transparent);
  font-size: 86px;
  line-height: 1;
  opacity: 0.18;
}

body::before {
  right: 332px;
  bottom: 34px;
  content: "J";
  transform: rotate(-12deg);
}

body::after {
  top: 74px;
  right: 324px;
  content: "☁";
  transform: rotate(8deg);
}

:root[data-theme="dark"] body::before {
  content: "☠";
  color: #ffcf5c;
  opacity: 0.16;
}

:root[data-theme="dark"] body::after {
  content: "✦";
  color: #86ccff;
  opacity: 0.2;
}

button,
input,
textarea,
select {
  border: 0;
  color: inherit;
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent);
  outline-offset: 2px;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr) 300px;
  width: 100vw;
  height: 100vh;
  min-width: 0;
}

.auth-root {
  position: relative;
  z-index: 1;
  display: block;
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
}

#app.auth-root,
#app:has(.auth-shell) {
  display: block;
  grid-template-columns: none;
  width: 100vw;
  height: 100vh;
}

.library,
.inspector {
  min-width: 0;
  overflow: hidden;
}

.library {
  display: grid;
  grid-template-rows:
    auto
    auto
    minmax(112px, 0.95fr)
    minmax(76px, 0.52fr)
    minmax(116px, 0.76fr)
    minmax(88px, 0.46fr);
  gap: 12px;
  height: 100vh;
  min-height: 0;
  padding: 20px 16px;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
}

.auth-shell {
  position: relative;
  display: grid;
  width: 100vw;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  overflow: hidden;
  background:
    radial-gradient(circle at 22% 20%, rgba(158, 216, 236, 0.22), transparent 280px),
    radial-gradient(circle at 78% 80%, rgba(255, 200, 92, 0.2), transparent 320px),
    var(--bg);
}

.app-shell > .auth-shell {
  grid-column: 1 / -1;
}

.auth-shell::before {
  position: absolute;
  inset: auto auto 8% 8%;
  color: color-mix(in srgb, var(--accent) 42%, transparent);
  content: "J の 文字";
  font-size: 64px;
  font-weight: 800;
  opacity: 0.16;
  transform: rotate(-8deg);
}

.auth-card {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(420px, 100%);
  gap: 16px;
  justify-items: center;
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 28px;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  box-shadow: var(--shadow);
  text-align: center;
}

.auth-card h1 {
  margin: 0;
  font-size: 30px;
}

.auth-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.auth-form {
  display: grid;
  width: 100%;
  gap: 14px;
  margin-top: 10px;
}

.auth-form input {
  min-height: 52px;
  padding: 0 18px;
  border: 1px solid rgba(56, 48, 38, 0.08);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.82)),
    var(--paper);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    0 10px 24px rgba(112, 91, 61, 0.06);
  color: var(--text);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.auth-form input:hover {
  border-color: rgba(56, 48, 38, 0.14);
  background:
    linear-gradient(180deg, #ffffff, rgba(255, 255, 255, 0.9)),
    var(--paper);
}

.auth-form input:focus {
  border-color: color-mix(in srgb, var(--accent) 46%, white);
  background: #ffffff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    0 0 0 5px color-mix(in srgb, var(--accent) 18%, transparent),
    0 14px 30px rgba(112, 91, 61, 0.09);
  transform: translateY(-1px);
  outline: none;
}

.auth-form input::placeholder {
  color: color-mix(in srgb, var(--muted) 74%, white);
}

.auth-error {
  padding: 10px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--red) 12%, transparent);
  color: var(--red);
  font-size: 13px;
}

.auth-switch {
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.brand-row,
.search-box,
.folder-row,
.note-card,
.recent-row,
.editor-toolbar,
.toolbar-actions,
.document-meta,
.save-status,
.breadcrumb,
.inspector-title,
.tag-color-row,
.command-input-row,
.command-actions button {
  display: flex;
  align-items: center;
}

.brand-row {
  gap: 12px;
}

.brand-mark,
.soft-button,
.icon-button,
.mini-button {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  transition:
    transform 160ms ease,
    background 160ms ease,
    border-color 160ms ease;
}

.brand-mark,
.soft-button,
.icon-button {
  width: 38px;
  height: 38px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  overflow: hidden;
  border-color: rgba(255, 255, 255, 0.82);
  background: #fff7dd;
  color: var(--accent-ink);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 10px 24px rgba(111, 90, 58, 0.12);
  font-weight: 800;
}

:root[data-theme="dark"] .brand-mark {
  border-color: rgba(255, 255, 255, 0.14);
  background: #20263f;
}

.mini-button {
  width: 28px;
  height: 28px;
}

.logout-button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--red) 24%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--red) 8%, var(--paper));
  color: color-mix(in srgb, var(--red) 82%, var(--text));
  font-size: 12px;
  font-weight: 760;
  white-space: nowrap;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.58),
    0 8px 18px rgba(112, 91, 61, 0.06);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.logout-button:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--red) 42%, var(--line));
  background: color-mix(in srgb, var(--red) 13%, var(--paper));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.66),
    0 12px 24px color-mix(in srgb, var(--red) 12%, transparent);
}

:root[data-theme="dark"] .logout-button {
  border-color: color-mix(in srgb, var(--red) 34%, var(--line));
  background: color-mix(in srgb, var(--red) 12%, var(--paper));
  color: color-mix(in srgb, var(--red) 74%, #ffffff);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 10px 24px rgba(0, 0, 0, 0.18);
}

.brand-mark:hover,
.soft-button:hover,
.icon-button:hover,
.mini-button:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: var(--paper);
}

.brand-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.brand-copy strong {
  font-size: 17px;
}

.brand-doodle {
  width: 39px;
  height: 39px;
  transform: translate(-4px, 1px);
  transform-origin: 50% 50%;
  transform-box: fill-box;
}

.doodle-fill {
  fill: #9ed8ec;
}

.doodle-line {
  fill: none;
  stroke: #22201c;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3.8;
}

.doodle-eye {
  fill: none;
  stroke: #22201c;
  stroke-linecap: round;
  stroke-width: 4.2;
}

.doodle-eye-dot,
.doodle-nose {
  fill: #22201c;
}

.doodle-cheek {
  fill: #ffc85c;
  opacity: 0.86;
}

.doodle-mouth-line,
.doodle-mouth,
.doodle-hand {
  stroke: #22201c;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.doodle-mouth-line {
  stroke-width: 3.2;
}

.doodle-mouth {
  stroke-width: 3.8;
}

.doodle-carton {
  fill: #f4b1a8;
  stroke: #22201c;
  stroke-linejoin: round;
  stroke-width: 3.4;
}

.doodle-carton-top {
  fill: #fff7e4;
  stroke: #22201c;
  stroke-linejoin: round;
  stroke-width: 3.2;
}

.doodle-carton-label {
  fill: none;
  stroke: #4a8992;
  stroke-linecap: round;
  stroke-width: 2.2;
}

.doodle-hand {
  stroke-width: 3.7;
}

.brand-mark:hover .brand-doodle {
  transform: translate(-4px, 0);
}

.brand-doodle {
  transition: transform 160ms ease;
}

.doodle-tooth {
  stroke: #f8fff0;
  stroke-linecap: round;
  stroke-width: 3.8;
}

.brand-copy span,
.section-title,
.note-card span,
.note-card-meta,
.recent-row time,
.document-meta,
.pane-heading,
.empty-inspector,
kbd {
  color: var(--muted);
  font-size: 12px;
}

.search-box {
  gap: 8px;
  min-height: 48px;
  padding: 0 8px 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 10px 28px rgba(115, 94, 63, 0.08);
  transition:
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

:root[data-theme="dark"] .search-box {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(28, 34, 55, 0.82);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 16px 34px rgba(0, 0, 0, 0.18);
}

:root[data-theme="dark"] .search-box:focus-within {
  border-color: rgba(255, 207, 92, 0.44);
  background: rgba(31, 38, 62, 0.94);
}

.search-box:focus-within {
  border-color: color-mix(in srgb, var(--accent) 38%, white);
  background: rgba(255, 255, 255, 0.92);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 0 0 5px var(--glow),
    0 14px 34px rgba(115, 94, 63, 0.1);
  transform: translateY(-1px);
}

.search-box input {
  min-width: 0;
  width: 100%;
  background: transparent;
  color: var(--text);
  outline: none;
  border-radius: 999px;
}

.search-box input::placeholder {
  color: color-mix(in srgb, var(--muted) 58%, white);
}

:root[data-theme="dark"] .search-box input::placeholder {
  color: color-mix(in srgb, var(--muted) 72%, transparent);
}

.search-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 4px;
  margin-left: 2px;
  padding: 5px 8px 5px 7px;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, rgba(56, 48, 38, 0.08));
  border-radius: 999px;
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.96), transparent 34%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.86), color-mix(in srgb, var(--accent) 10%, var(--paper)));
  color: color-mix(in srgb, var(--text) 78%, var(--accent));
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0.02em;
  line-height: 1;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 7px 16px rgba(111, 90, 58, 0.07);
  pointer-events: none;
  white-space: nowrap;
}

.search-chip-icon {
  position: relative;
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border: 1.4px solid currentColor;
  border-radius: 50%;
  opacity: 0.82;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.22);
}

.search-chip-icon::after {
  position: absolute;
  right: -3px;
  bottom: -2px;
  width: 5px;
  height: 1.4px;
  border-radius: 999px;
  background: currentColor;
  content: "";
  opacity: 0.82;
  transform: rotate(45deg);
  transform-origin: center;
}

:root[data-theme="dark"] .search-chip {
  border-color: color-mix(in srgb, var(--accent) 25%, rgba(255, 255, 255, 0.1));
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.12), transparent 34%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), color-mix(in srgb, var(--accent) 8%, var(--paper)));
  color: color-mix(in srgb, var(--accent) 72%, #ffffff);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 8px 16px rgba(0, 0, 0, 0.18);
}

kbd {
  margin-left: auto;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper-soft);
}

.library-section {
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 8px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  border-radius: 18px;
  background: color-mix(in srgb, var(--paper) 58%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.46);
  overflow: hidden;
}

:root[data-theme="dark"] .library-section {
  background: color-mix(in srgb, var(--paper) 54%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.folder-section {
  min-height: 0;
  max-height: none;
  overflow: auto;
}

.tag-section {
  min-height: 0;
  max-height: none;
}

.tag-cloud {
  min-height: 0;
  overflow: auto;
  padding: 1px 2px 2px 0;
}

.notes-section {
  min-height: 0;
  max-height: none;
}

.recent-list {
  min-height: 0;
  max-height: none;
  overflow: auto;
}

.library-section::-webkit-scrollbar,
.tag-cloud::-webkit-scrollbar,
.note-list::-webkit-scrollbar,
.keyword-list::-webkit-scrollbar,
.match-list::-webkit-scrollbar,
.file-list::-webkit-scrollbar,
.tag-color-list::-webkit-scrollbar,
.inspector::-webkit-scrollbar,
.preview-pane::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.library-section::-webkit-scrollbar-thumb,
.tag-cloud::-webkit-scrollbar-thumb,
.note-list::-webkit-scrollbar-thumb,
.keyword-list::-webkit-scrollbar-thumb,
.match-list::-webkit-scrollbar-thumb,
.file-list::-webkit-scrollbar-thumb,
.tag-color-list::-webkit-scrollbar-thumb,
.inspector::-webkit-scrollbar-thumb,
.preview-pane::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 28%, transparent);
}

.library-section::-webkit-scrollbar-track,
.tag-cloud::-webkit-scrollbar-track,
.note-list::-webkit-scrollbar-track,
.keyword-list::-webkit-scrollbar-track,
.match-list::-webkit-scrollbar-track,
.file-list::-webkit-scrollbar-track,
.tag-color-list::-webkit-scrollbar-track,
.inspector::-webkit-scrollbar-track,
.preview-pane::-webkit-scrollbar-track {
  background: transparent;
}

.section-title {
  text-transform: uppercase;
  font-weight: 760;
}

.folder-row {
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 0 10px 0 calc(10px + var(--level, 0) * 18px);
  border-radius: 14px;
  background: transparent;
  text-align: left;
}

.folder-row:hover,
.folder-row.is-active {
  background: color-mix(in srgb, var(--paper) 78%, transparent);
}

.folder-row span:nth-child(3) {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-row small {
  color: var(--faint);
}

.folder-caret {
  display: grid;
  place-items: center;
  width: 14px;
  color: var(--faint);
  font-size: 17px;
  line-height: 1;
  transition: transform 150ms ease;
}

.folder-caret.is-open {
  transform: rotate(90deg);
}

.folder-dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--folder, #c7c9d1);
}

.subpage-list {
  display: grid;
  gap: 3px;
  margin: -2px 0 4px 32px;
}

.subpage-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.subpage-row:hover,
.subpage-row.is-active {
  background: color-mix(in srgb, var(--paper) 72%, transparent);
  color: var(--text);
}

.subpage-row span:first-child {
  width: 5px;
  height: 5px;
  border-radius: 99px;
  background: var(--faint);
  opacity: 0.7;
}

.subpage-row span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.folder-dot.all {
  background: linear-gradient(135deg, #f6b73c, #78c6a3);
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-chip {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid color-mix(in srgb, var(--tag, var(--accent)) 35%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--tag, var(--accent)) 18%, transparent);
  color: var(--text);
  font-size: 12px;
}

.tag-chip.is-active {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tag, var(--accent)) 62%, transparent);
}

.note-list {
  display: grid;
  gap: 6px;
  overflow: auto;
  padding-right: 4px;
}

.note-card {
  position: relative;
  gap: 8px;
  width: 100%;
  min-width: 0;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  text-align: left;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.note-card:hover,
.note-card.is-active {
  border-color: var(--line);
  background: var(--paper);
  box-shadow: 0 12px 32px rgba(111, 90, 58, 0.08);
}

.note-card.is-active::before {
  position: absolute;
  inset: 8px auto 8px 0;
  width: 3px;
  border-radius: 99px;
  background: var(--accent);
  content: "";
}

.drag-handle {
  flex: 0 0 auto;
  color: var(--faint);
  font-size: 12px;
}

.note-card-main {
  display: grid;
  min-width: 0;
  gap: 0;
}

.note-card strong,
.note-card-main > span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-card strong {
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
  white-space: nowrap;
}

.note-card-main > span:not(.note-card-meta) {
  display: -webkit-box;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.note-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.note-card-meta i {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--folder);
}

.recent-row {
  justify-content: space-between;
  gap: 8px;
  min-height: 22px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
}

.recent-row time {
  flex: 0 0 auto;
  font-size: 11px;
}

.recent-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-note-list,
.empty-inspector {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

.editor {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.editor-toolbar {
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 86%, var(--paper));
}

.breadcrumb {
  min-width: 0;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.breadcrumb span:first-child {
  width: 10px;
  height: 10px;
  border-radius: 99px;
  background: var(--folder);
}

.breadcrumb span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breadcrumb em {
  color: var(--faint);
  font-style: normal;
}

.toolbar-actions {
  gap: 10px;
}

.save-status {
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 99px;
  background: var(--accent);
  animation: pulse 1s ease infinite;
}

.segmented {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--paper-soft) 72%, white);
}

.segmented button {
  min-width: 68px;
  height: 31px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.segmented button.is-active {
  background: var(--paper);
  color: var(--text);
  box-shadow: 0 8px 18px rgba(107, 86, 56, 0.1);
}

.danger:hover {
  color: var(--red);
}

.delete-note-button {
  position: relative;
  width: 42px;
  height: 42px;
  overflow: hidden;
  border-color: color-mix(in srgb, var(--red) 20%, var(--line));
  border-radius: 15px;
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.92), transparent 30%),
    linear-gradient(145deg, color-mix(in srgb, var(--red) 7%, var(--paper)), color-mix(in srgb, var(--accent) 8%, var(--paper)));
  color: color-mix(in srgb, var(--red) 80%, var(--text));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 10px 24px rgba(140, 82, 74, 0.08);
  isolation: isolate;
}

.delete-note-button::before {
  position: absolute;
  inset: 8px;
  z-index: -1;
  border-radius: 12px;
  background: color-mix(in srgb, var(--red) 11%, transparent);
  content: "";
  opacity: 0;
  transform: scale(0.72) rotate(-8deg);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.delete-note-button::after {
  position: absolute;
  right: 7px;
  bottom: 7px;
  width: 9px;
  height: 9px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  border-radius: 1px 1px 4px 1px;
  content: "";
  opacity: 0.38;
  transform: rotate(5deg);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.delete-note-button:hover {
  border-color: color-mix(in srgb, var(--red) 38%, var(--line));
  background:
    radial-gradient(circle at 26% 16%, rgba(255, 255, 255, 0.96), transparent 32%),
    linear-gradient(145deg, color-mix(in srgb, var(--red) 12%, var(--paper)), color-mix(in srgb, var(--accent) 11%, var(--paper)));
  color: color-mix(in srgb, var(--red) 92%, #7a1f2c);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 16px 30px rgba(217, 75, 87, 0.16);
}

.delete-note-button:hover::before {
  opacity: 1;
  transform: scale(1) rotate(-8deg);
}

.delete-note-button:hover::after {
  opacity: 0.72;
  transform: translate(1px, -1px) rotate(-7deg);
}

.delete-note-svg {
  width: 23px;
  height: 23px;
  overflow: visible;
}

.delete-note-paper {
  fill: color-mix(in srgb, var(--paper) 92%, #fff1f2);
  stroke: currentColor;
  stroke-linejoin: round;
  stroke-width: 1.55;
  transition:
    fill 180ms ease,
    transform 180ms ease;
}

.delete-note-fold,
.delete-note-line,
.delete-note-lift {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.55;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.delete-note-fold {
  opacity: 0.72;
}

.delete-note-line {
  opacity: 0.62;
}

.delete-note-lift {
  opacity: 0.34;
  transform-origin: 12px 19px;
}

.delete-note-button:hover .delete-note-paper {
  fill: color-mix(in srgb, var(--red) 8%, var(--paper));
  transform: translateY(-1.5px) rotate(-4deg);
}

.delete-note-button:hover .delete-note-fold,
.delete-note-button:hover .delete-note-line {
  transform: translateY(-1.5px) rotate(-4deg);
}

.delete-note-button:hover .delete-note-lift {
  opacity: 0.72;
  transform: translateY(1px) scaleX(0.88);
}

.delete-note-button:focus-visible {
  outline-color: color-mix(in srgb, var(--red) 58%, transparent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 0 0 5px color-mix(in srgb, var(--red) 15%, transparent),
    0 16px 30px rgba(217, 75, 87, 0.14);
}

:root[data-theme="dark"] .delete-note-button {
  border-color: color-mix(in srgb, var(--red) 28%, var(--line));
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.12), transparent 30%),
    linear-gradient(145deg, color-mix(in srgb, var(--red) 14%, var(--paper)), color-mix(in srgb, #ffd98a 7%, var(--paper)));
  color: #ff9caf;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 14px 30px rgba(0, 0, 0, 0.2);
}

:root[data-theme="dark"] .delete-note-button:hover {
  border-color: color-mix(in srgb, var(--red) 48%, var(--line));
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.16), transparent 32%),
    linear-gradient(145deg, color-mix(in srgb, var(--red) 22%, var(--paper)), color-mix(in srgb, #ffd98a 10%, var(--paper)));
  color: #ffc3cf;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 18px 34px rgba(255, 127, 152, 0.18);
}

:root[data-theme="dark"] .delete-note-paper {
  fill: color-mix(in srgb, var(--paper) 86%, #fff1f2);
}

.document-head {
  display: grid;
  gap: 16px;
  padding: 38px 54px 22px;
}

.title-input {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 6px 10px 8px;
  border: 1px solid transparent;
  border-radius: 16px;
  background: transparent;
  color: var(--text);
  font-size: 44px;
  font-weight: 760;
  line-height: 1.08;
  text-overflow: ellipsis;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.title-input:hover {
  background: color-mix(in srgb, var(--paper-soft) 34%, transparent);
}

.title-input:focus,
.title-input:focus-visible {
  outline: none;
  border-color: rgba(246, 183, 60, 0.24);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 4%, var(--paper)), color-mix(in srgb, var(--paper) 84%, transparent));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 0 0 4px rgba(246, 183, 60, 0.1);
}

:root[data-theme="dark"] .title-input:hover {
  background: color-mix(in srgb, var(--paper-soft) 38%, transparent);
}

:root[data-theme="dark"] .title-input:focus,
:root[data-theme="dark"] .title-input:focus-visible {
  border-color: rgba(255, 207, 92, 0.28);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 6%, var(--paper)), color-mix(in srgb, var(--paper) 86%, transparent));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 0 4px rgba(255, 207, 92, 0.13);
}

.document-meta {
  flex-wrap: wrap;
  gap: 10px;
}

.document-meta input,
.document-meta select {
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  color: var(--muted);
  font-size: 13px;
}

.document-meta input {
  width: min(430px, 100%);
}

.editor-surface {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 0;
  flex: 1;
  margin: 0 44px 38px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--paper);
  box-shadow: var(--shadow);
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

.editor-surface:focus-within {
  border-color: color-mix(in srgb, var(--accent) 32%, var(--line));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 3%, var(--paper)), var(--paper) 44%),
    var(--paper);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.76),
    0 0 0 5px color-mix(in srgb, var(--accent) 12%, transparent),
    0 20px 58px rgba(115, 94, 63, 0.12);
}

:root[data-theme="dark"] .editor-surface:focus-within {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 5%, var(--paper)), var(--paper) 46%),
    var(--paper);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 0 5px color-mix(in srgb, var(--accent) 14%, transparent),
    0 24px 70px rgba(0, 0, 0, 0.36);
}

.editor-surface.mode-split {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.write-pane,
.preview-pane {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
}

.mode-preview .write-pane,
.mode-write .preview-pane {
  display: none;
}

.editor-surface.mode-split .write-pane {
  border-right: 1px solid var(--line);
}

.pane-heading {
  flex: 0 0 auto;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  font-weight: 760;
  text-transform: uppercase;
}

.format-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--paper-soft) 66%, var(--paper)), color-mix(in srgb, var(--paper-soft) 48%, var(--paper))),
    var(--paper-soft);
}

.format-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 33px;
  min-width: 32px;
  padding: 0 7px;
  border: 1px solid color-mix(in srgb, var(--line) 86%, transparent);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.42)),
    color-mix(in srgb, var(--paper) 84%, var(--paper-soft));
  color: color-mix(in srgb, var(--text) 78%, var(--muted));
  font-size: 12px;
  font-weight: 760;
  line-height: 1;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 7px 16px rgba(111, 90, 58, 0.05);
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    background 150ms ease,
    color 150ms ease,
    box-shadow 150ms ease;
}

.format-button::after {
  position: absolute;
  inset: auto 9px 5px;
  height: 1px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--accent) 42%, transparent);
  content: "";
  opacity: 0;
  transform: scaleX(0.5);
  transition:
    opacity 150ms ease,
    transform 150ms ease;
}

.format-button:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 28%, var(--line-strong));
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.58)),
    color-mix(in srgb, var(--accent) 6%, var(--paper));
  color: var(--text);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.88),
    0 10px 22px rgba(111, 90, 58, 0.08);
}

.format-button:hover::after {
  opacity: 1;
  transform: scaleX(1);
}

.format-button:focus-visible {
  outline: none;
  border-color: rgba(246, 183, 60, 0.38);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.88),
    0 0 0 4px rgba(246, 183, 60, 0.11);
}

.format-text {
  min-width: 38px;
}

.format-text span {
  font-weight: 860;
}

.format-icon {
  width: 32px;
  padding: 0;
  font-size: 15px;
}

.format-icon strong,
.format-icon em {
  font-size: 15px;
  line-height: 1;
}

.format-code {
  min-width: 39px;
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.format-file {
  min-width: 52px;
  color: color-mix(in srgb, var(--blue) 78%, var(--text));
}

.attachment-icon {
  position: relative;
  width: 10px;
  height: 14px;
  border: 1.5px solid currentColor;
  border-left-width: 0;
  border-radius: 0 7px 7px 0;
  opacity: 0.86;
  transform: rotate(42deg);
}

.attachment-icon::before {
  position: absolute;
  inset: 2px 2px 2px auto;
  width: 5px;
  border: 1.5px solid currentColor;
  border-left-width: 0;
  border-radius: 0 5px 5px 0;
  content: "";
}

:root[data-theme="dark"] .format-bar {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--paper-soft) 72%, var(--paper)), color-mix(in srgb, var(--paper-soft) 54%, var(--paper))),
    var(--paper-soft);
}

:root[data-theme="dark"] .format-button {
  border-color: color-mix(in srgb, var(--line) 86%, transparent);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.03)),
    color-mix(in srgb, var(--paper) 84%, var(--paper-soft));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 9px 18px rgba(0, 0, 0, 0.14);
}

:root[data-theme="dark"] .format-button:hover {
  border-color: color-mix(in srgb, var(--accent) 34%, var(--line-strong));
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.04)),
    color-mix(in srgb, var(--accent) 7%, var(--paper));
}

.hidden-file-input {
  display: none;
}

textarea {
  width: 100%;
  min-height: 0;
  flex: 1;
  resize: none;
  padding: 30px;
  background: transparent;
  color: var(--text);
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  line-height: 1.78;
  white-space: pre-wrap;
  caret-color: color-mix(in srgb, var(--accent) 78%, var(--text));
}

textarea:focus,
textarea:focus-visible {
  outline: none;
}

.preview-pane {
  overflow: auto;
}

.preview-content {
  width: 100%;
  max-width: 820px;
  padding: 32px 38px 64px;
  animation: fadeSlide 180ms ease both;
}

.preview-content h1,
.preview-content h2,
.preview-content h3 {
  margin: 1.45em 0 0.55em;
  line-height: 1.18;
}

.preview-content h1:first-child,
.preview-content h2:first-child,
.preview-content h3:first-child {
  margin-top: 0;
}

.preview-content h1 {
  font-size: 34px;
}

.preview-content h2 {
  font-size: 24px;
}

.preview-content h3 {
  font-size: 18px;
}

.preview-content p,
.preview-content li {
  color: color-mix(in srgb, var(--text) 84%, var(--muted));
  font-size: 15px;
  line-height: 1.84;
}

.preview-content a {
  color: var(--blue);
}

.preview-content ul,
.preview-content ol {
  padding-left: 24px;
}

.task-item {
  list-style: none;
}

.task-item input {
  width: 16px;
  height: 16px;
  margin: 0 8px 0 -22px;
  accent-color: var(--accent);
  vertical-align: middle;
}

.preview-content code {
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--paper-soft);
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

.preview-content pre {
  max-width: 100%;
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #282923;
  color: #f8f8f2;
}

.preview-content pre code {
  display: block;
  width: max-content;
  min-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  white-space: pre;
}

.token-keyword {
  color: #8bd5ff;
}

.token-string {
  color: #f6e58d;
}

.token-number {
  color: #ffb86b;
}

.preview-content blockquote {
  margin: 22px 0;
  padding: 2px 0 2px 16px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

.text-highlight {
  padding: 1px 3px;
  border-radius: 5px;
  background: var(--mark);
  color: var(--mark-ink, #1f1b12);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.text-highlight.search {
  box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--blue) 45%, transparent);
}

:root[data-theme="dark"] .text-highlight {
  border: 1px solid color-mix(in srgb, var(--mark) 62%, rgba(255, 255, 255, 0.22));
  background: color-mix(in srgb, var(--mark) 88%, #ffffff);
  color: var(--mark-ink, #1f1b12);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.12),
    0 0 18px color-mix(in srgb, var(--mark) 18%, transparent);
}

:root[data-theme="dark"] .text-highlight.search {
  border-color: color-mix(in srgb, var(--blue) 58%, rgba(255, 255, 255, 0.22));
  box-shadow:
    inset 0 -2px 0 color-mix(in srgb, var(--blue) 72%, transparent),
    0 0 16px color-mix(in srgb, var(--blue) 18%, transparent);
}

.inspector {
  display: grid;
  grid-template-rows:
    minmax(126px, auto)
    minmax(138px, 1fr)
    minmax(120px, 0.85fr)
    minmax(96px, 0.65fr)
    minmax(158px, 1.05fr);
  gap: 12px;
  height: 100vh;
  min-height: 0;
  padding: 20px 16px;
  border-left: 1px solid var(--line);
  background: var(--inspector);
  overflow: hidden;
}

.inspector-block {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  border-radius: 18px;
  background: color-mix(in srgb, var(--paper) 62%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.46);
  overflow: hidden;
}

.user-block {
  min-height: 126px;
}

:root[data-theme="dark"] .inspector-block {
  background: color-mix(in srgb, var(--paper) 56%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.inspector-title {
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.inspector-title strong {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inspector-title span {
  color: var(--muted);
  font-size: 12px;
}

.keyword-list,
.match-list,
.file-list,
.tag-color-list {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.keyword-row {
  display: grid;
  grid-template-columns: 1fr 1fr 34px;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
}

.keyword-row input[type="text"],
.keyword-row input:not([type]) {
  min-width: 0;
}

.keyword-row input {
  width: 100%;
  min-height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-soft);
  font-size: 12px;
}

.keyword-row input[type="color"] {
  padding: 3px;
}

.regex-toggle {
  grid-column: span 2;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.regex-toggle input {
  width: 14px;
  min-height: 14px;
  accent-color: var(--accent);
}

.keyword-row .mini-button {
  grid-column: 3;
  grid-row: 2;
  justify-self: end;
}

.match-row {
  display: grid;
  gap: 5px;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  text-align: left;
}

.match-row small {
  color: var(--faint);
  font-size: 11px;
}

.match-row span {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.tag-color-row {
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
}

.tag-color-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.tag-color-row input {
  width: 30px;
  height: 26px;
  padding: 2px;
  border-radius: 8px;
  background: transparent;
}

.file-list {
  display: grid;
  gap: 8px;
}

.file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--text);
  font-size: 12px;
  text-decoration: none;
}

.file-row span {
  color: var(--faint);
  white-space: nowrap;
}

.user-mantra {
  position: relative;
  display: grid;
  gap: 2px;
  min-height: 48px;
  place-items: center;
  padding: 9px 14px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.28)),
    color-mix(in srgb, var(--accent) 7%, var(--paper));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    0 12px 28px rgba(111, 90, 58, 0.06);
}

.user-mantra::before {
  position: absolute;
  inset: 7px 12px;
  border: 1px dashed color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 13px;
  content: "";
  opacity: 0.7;
}

.user-mantra::after {
  position: absolute;
  top: 8px;
  right: 18px;
  width: 36px;
  height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 62%, transparent), transparent);
  content: "";
  transform: rotate(-18deg);
}

.user-mantra span {
  position: relative;
  z-index: 1;
  color: color-mix(in srgb, var(--text) 88%, var(--accent));
  font-family: "STKaiti", "KaiTi", "Songti SC", serif;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.24;
  text-align: center;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.82),
    0 8px 18px rgba(111, 90, 58, 0.1);
  white-space: nowrap;
}

.user-mantra span:first-child {
  transform: translateX(-6px);
}

.user-mantra span:last-child {
  transform: translateX(6px);
  color: color-mix(in srgb, var(--accent) 72%, var(--text));
}

:root[data-theme="dark"] .user-mantra {
  border-color: color-mix(in srgb, var(--accent) 34%, var(--line));
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
    color-mix(in srgb, var(--accent) 9%, var(--paper));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 16px 32px rgba(0, 0, 0, 0.22);
}

:root[data-theme="dark"] .user-mantra::before {
  border-color: color-mix(in srgb, var(--accent) 28%, transparent);
  opacity: 0.62;
}

:root[data-theme="dark"] .user-mantra span {
  color: #fff4d0;
  text-shadow:
    0 0 14px rgba(255, 207, 92, 0.2),
    0 8px 20px rgba(0, 0, 0, 0.28);
}

:root[data-theme="dark"] .user-mantra span:last-child {
  color: #ffcf5c;
}

.empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  min-height: 100%;
  padding: 32px;
  text-align: center;
}

.empty-glyph {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 34px;
}

.empty-state h1 {
  margin: 0;
  font-size: 34px;
}

.empty-state p {
  max-width: 460px;
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.primary-action {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 760;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    0 12px 28px color-mix(in srgb, var(--accent) 22%, transparent);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    filter 160ms ease;
}

.primary-action:hover {
  filter: saturate(1.04);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.38),
    0 16px 34px color-mix(in srgb, var(--accent) 28%, transparent);
}

.command-layer {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 20;
  opacity: 0;
  transition: opacity 160ms ease;
}

.command-layer.is-open {
  pointer-events: auto;
  opacity: 1;
}

.command-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(36, 33, 28, 0.26);
  backdrop-filter: blur(12px);
}

.command-panel {
  position: absolute;
  top: 12vh;
  left: 50%;
  display: grid;
  width: min(680px, calc(100vw - 32px));
  max-height: min(700px, 76vh);
  transform: translateX(-50%) translateY(10px);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: var(--shadow);
  transition: transform 160ms ease;
}

.command-layer.is-open .command-panel {
  transform: translateX(-50%) translateY(0);
}

.command-input-row {
  gap: 12px;
  min-height: 60px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}

.command-input-row input {
  min-width: 0;
  flex: 1;
  background: transparent;
  font-size: 16px;
}

.command-actions {
  display: flex;
  gap: 8px;
  padding: 12px;
}

.command-actions button {
  flex: 1;
  gap: 10px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper-soft);
}

.command-results {
  display: grid;
  gap: 4px;
  overflow: auto;
  padding: 0 12px 12px;
}

.command-results button {
  display: grid;
  gap: 5px;
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  background: transparent;
  text-align: left;
}

.command-results button:hover {
  background: var(--paper-soft);
}

.command-results span {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toast-zone {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 30;
}

.toast {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 44px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 0 10px 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: var(--shadow);
  animation: fadeSlide 160ms ease both;
}

.toast span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toast button {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 720;
}

@keyframes pulse {
  50% {
    opacity: 0.35;
    transform: scale(0.76);
  }
}

@keyframes fadeSlide {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 290px minmax(0, 1fr);
  }

  .inspector {
    display: none;
  }
}

@media (max-width: 860px) {
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
    width: 100%;
    height: auto;
    min-height: 100vh;
  }

  .auth-root {
    width: 100%;
  }

  .auth-shell {
    min-height: 100svh;
    padding: 20px;
  }

  .auth-card {
    width: min(420px, 100%);
    padding: 28px 24px;
    border-radius: 24px;
  }

  .library {
    position: relative;
    grid-template-rows:
      auto
      auto
      minmax(110px, 0.9fr)
      minmax(72px, 0.5fr)
      minmax(112px, 0.72fr)
      minmax(84px, 0.44fr);
    height: min(66svh, 620px);
    max-height: 66svh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .recent-list {
    min-height: 0;
    max-height: none;
  }

  .folder-section {
    min-height: 0;
    max-height: none;
  }

  .tag-section {
    min-height: 0;
    max-height: none;
  }

  .notes-section {
    min-height: 0;
    max-height: none;
  }

  .editor-toolbar {
    flex-wrap: wrap;
    min-height: auto;
    padding: 14px 18px;
  }

  .toolbar-actions {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
  }

  .document-head {
    padding: 28px 20px 18px;
  }

  .title-input {
    font-size: 32px;
  }

  .editor-surface,
  .editor-surface.mode-split {
    grid-template-columns: 1fr;
    width: calc(100% - 28px);
    margin: 0 14px 20px;
  }

  .editor-surface.mode-split .write-pane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .mode-split .write-pane,
  .mode-split .preview-pane {
    min-height: 360px;
  }

  .preview-content {
    padding: 26px 22px 46px;
  }
}

@media (max-width: 560px) {
  body {
    overflow-x: hidden;
  }

  body::before,
  body::after {
    display: none;
  }

  .auth-shell {
    align-items: center;
    padding: 16px;
  }

  .auth-shell::before {
    left: 18px;
    bottom: 4%;
    font-size: 42px;
  }

  .auth-card {
    padding: 24px 18px;
    border-radius: 22px;
  }

  .auth-card h1 {
    font-size: 28px;
  }

  .auth-card p {
    font-size: 14px;
  }

  .auth-form input {
    min-height: 48px;
  }

  .search-chip,
  .breadcrumb {
    display: none;
  }

  .segmented button {
    min-width: 50px;
  }

  .brand-row {
    align-items: flex-start;
  }

  .brand-mark,
  .soft-button,
  .icon-button {
    width: 40px;
    height: 40px;
  }

  .brand-doodle {
    width: 34px;
    height: 34px;
  }

  .library {
    padding: 16px 12px;
  }

  .editor-toolbar {
    padding: 12px;
  }

  .toolbar-actions {
    flex-wrap: wrap;
  }

  .document-head {
    padding: 22px 14px 14px;
  }

  .title-input {
    font-size: 28px;
  }

  .format-bar {
    gap: 6px;
    padding: 9px;
  }

  .format-button {
    min-width: auto;
    height: 28px;
    padding: 0 7px;
  }

  .format-text {
    min-width: 58px;
  }

  .format-icon {
    width: 30px;
  }

  textarea {
    padding: 18px;
  }

  .preview-content pre code {
    width: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  .document-meta {
    align-items: stretch;
    flex-direction: column;
  }

  .document-meta input,
  .document-meta select {
    width: 100%;
  }

  .command-actions {
    flex-direction: column;
  }
}
