*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: Georgia, "Times New Roman", serif;
  background: #fafafa;
  color: #222;
  line-height: 1.6;
}

#app {
  max-width: 680px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

/* List view */
#list-view h1 {
  font-size: 1.25rem;
  font-weight: normal;
  color: #555;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0;
}

.list-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
}

.list-page-link {
  font-family: system-ui, sans-serif;
  font-size: 0.82rem;
  color: #999;
  text-decoration: none;
  transition: color 0.15s;
}

.list-page-link:hover {
  color: #555;
}

#doc-list {
  list-style: none;
}

.doc-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid #e8e8e8;
  padding: 0.4rem 0;
}

.doc-row:first-child {
  border-top: 1px solid #e8e8e8;
}

.doc-row:hover .doc-title {
  color: #555;
}

.doc-row-open {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
}

.doc-row-action {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  font-size: 0.78rem;
  font-family: system-ui, sans-serif;
  transition: color 0.15s;
}

.doc-row-action:hover {
  color: #555;
}

.doc-title {
  font-size: 1.05rem;
}

.doc-badge {
  font-size: 0.72rem;
  font-family: system-ui, sans-serif;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.doc-meta {
  font-size: 0.8rem;
  color: #aaa;
  margin-top: 0.2rem;
  font-family: system-ui, sans-serif;
}

#empty-state {
  color: #bbb;
  font-style: italic;
  padding: 2rem 0;
}

#new-doc-btn {
  margin-top: 2rem;
  background: none;
  border: 1px solid #ccc;
  padding: 0.45rem 1rem;
  font-size: 0.9rem;
  font-family: Georgia, serif;
  cursor: pointer;
  color: #555;
  transition: border-color 0.15s;
}

#new-doc-btn:hover {
  border-color: #888;
  color: #222;
}

.list-subtle-links {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #efefef;
  font-family: system-ui, sans-serif;
}

.list-subtle-links-label {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #aaa;
  margin-bottom: 0.45rem;
}

.list-subtle-links-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.9rem;
  list-style: none;
}

.list-subtle-link {
  font-size: 0.84rem;
  color: #888;
  text-decoration: none;
  transition: color 0.15s;
}

.list-subtle-link:hover {
  color: #555;
}

/* Editor view */
#editor-view {
  display: none;
}

#back-btn, #exp-back-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #aaa;
  font-size: 0.85rem;
  font-family: system-ui, sans-serif;
  padding: 0;
  margin-bottom: 2.5rem;
  display: block;
  transition: color 0.15s;
}

#back-btn:hover, #exp-back-btn:hover {
  color: #555;
}

#doc-title-input {
  display: block;
  width: 100%;
  font-size: 1.6rem;
  font-family: Georgia, serif;
  font-weight: normal;
  border: none;
  background: none;
  outline: none;
  color: #222;
  margin-bottom: 1.5rem;
}

#doc-title-input::placeholder {
  color: #ccc;
}

#editor-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  font-family: system-ui, sans-serif;
}

#insert-image-btn {
  background: none;
  border: 1px solid #ccc;
  padding: 0.4rem 0.8rem;
  font-size: 0.82rem;
  color: #555;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

#insert-image-btn:hover {
  border-color: #888;
  color: #222;
}

.editor-toolbar-note {
  font-size: 0.78rem;
  color: #999;
}

/* ProseMirror */
.ProseMirror {
  outline: none;
  min-height: 50vh;
  font-size: 1.05rem;
  line-height: 1.75;
  color: #333;
}

.ProseMirror p {
  margin-bottom: 1em;
}

.ProseMirror p:last-child {
  margin-bottom: 0;
}

.ProseMirror > * + * {
  margin-top: 0;
}

.ProseMirror img {
  max-width: 100%;
  height: auto;
  border-radius: 0.2rem;
  display: inline-block;
  vertical-align: middle;
}

.ProseMirror h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.6em;
  line-height: 1.3;
  color: #222;
}

.ProseMirror h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5em;
  line-height: 1.35;
  color: #333;
}

.ProseMirror h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5em;
  line-height: 1.4;
  color: #444;
}

/* Experiment view */
#experiment-view {
  display: none;
}

.exp-nav {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  font-family: system-ui, sans-serif;
  font-size: 0.85rem;
}

.exp-nav-link {
  color: #888;
  text-decoration: none;
  transition: color 0.15s;
}

.exp-nav-link:hover {
  color: #555;
}

.exp-nav-current {
  color: #222;
  font-weight: 500;
}

.exp-title {
  font-size: 1.15rem;
  font-weight: 500;
  color: #333;
  margin-bottom: 0.5rem;
}

.exp-desc {
  font-size: 0.9rem;
  color: #888;
  margin-bottom: 2rem;
  line-height: 1.5;
  font-family: system-ui, sans-serif;
}

@media (max-width: 640px) {
  .list-header,
  .doc-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .doc-row {
    gap: 0.15rem;
  }

  .doc-row-action {
    padding: 0 0 0.35rem;
  }
}
