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

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.7;
  color: #bccad8;
  background: #0b0f13;
}

/* Layout */
.layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 280px;
  min-width: 240px;
  background: #0d1117;
  color: #97a1b9;
  padding: 0 1rem 1.25rem;
  overflow-y: auto;
  border-right: 1px solid #2f3b4d;
}
.sidebar-banner {
  position: relative;
  width: calc(100% + 2rem);
  margin: 0 -1rem;
  max-height: 140px;
  overflow: hidden;
}
.sidebar-banner img {
  width: 100%;
  display: block;
  object-fit: cover;
  object-position: center 30%;
  max-height: 140px;
}
.sidebar-banner::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60%;
  background: linear-gradient(to bottom, transparent 0%, #0d1117 100%);
  pointer-events: none;
}
.sidebar-title {
  font-family: 'Calisto MT', 'Book Antiqua', Georgia, serif;
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: 0.25rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.75rem;
  color: #c14343;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: none;
  position: relative;
}
.sidebar-title::after {
  content: '';
  display: block;
  margin-top: 0.5rem;
  height: 2px;
  background: linear-gradient(90deg, #c14343 0%, #652121 60%, transparent 100%);
  border-radius: 0;
}
.sidebar ul {
  list-style: none;
  padding-left: 0.6rem;
}
.sidebar > div > ul {
  padding-left: 0;
}
.sidebar li {
  margin: 0.15rem 0;
}

/* Tree skeleton loader */
.tree-skeleton {
  padding: 0.5rem 0;
}
.tree-skeleton span {
  display: block;
  height: 0.75rem;
  margin: 0.55rem 0;
  border-radius: 0;
  background: linear-gradient(90deg, #1a1e24 25%, #252525 50%, #1a1e24 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
}
.tree-skeleton span:nth-child(odd) { width: 70%; margin-left: 0.6rem; }
.tree-skeleton span:nth-child(even) { width: 55%; }
.tree-skeleton span:nth-child(3) { width: 80%; }
.tree-skeleton span:nth-child(6) { width: 45%; margin-left: 0.6rem; }
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .tree-skeleton span { animation: none; background: #1a1e24; }
}

.sidebar a {
  color: #586477;
  text-decoration: none;
  font-size: 0.92rem;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  transition: color 0.15s;
  padding: 0.2rem 0.4rem;
  display: block;
  border-radius: 0;
}
.sidebar a:hover {
  color: #c94d4d;
  background: rgba(193,67,67,0.06);
}
.folder-toggle {
  cursor: pointer;
  font-size: 0.78rem;
  color: #c14343;
  user-select: none;
  font-family: 'Calisto MT', 'Book Antiqua', Georgia, serif;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.3rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.folder-toggle::before {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 4px 0 4px 6px;
  border-color: transparent transparent transparent #c14343;
  transition: transform 0.15s ease;
  flex-shrink: 0;
}
.folder-toggle[data-open="true"]::before {
  transform: rotate(90deg);
}
.folder-toggle:hover {
  color: #c94d4d;
}
.folder-toggle:hover::before {
  border-left-color: #c94d4d;
}

/* Content */
.content {
  flex: 1;
  max-width: 110ch;
  margin: 0 auto;
  padding: 3rem 2.5rem;
  color: #bccad8;
  width: 100%;
}
.content h1, .content h2, .content h3, .content h4 {
  font-family: 'Calisto MT', 'Book Antiqua', Georgia, serif;
  color: #c94d4d;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  font-weight: 700;
}
.content h1 {
  font-size: 2.4rem;
  border-bottom: none;
  padding-bottom: 0.6em;
  margin-top: 0;
  position: relative;
  letter-spacing: 0.02em;
}
.content h1::after {
  content: '';
  display: block;
  margin-top: 0.5em;
  height: 2px;
  background: linear-gradient(90deg, #c14343 0%, #652121 40%, transparent 100%);
  border-radius: 0;
}
.content h2 {
  font-size: 1.6rem;
  color: #c94d4d;
  margin-top: 2em;
}
.content h3 {
  font-size: 1.2rem;
  color: #c14343;
  font-weight: 700;
}
.content p {
  margin-bottom: 0.75em;
}
.content a {
  color: #61afef; text-decoration: none; border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}
.content a:hover { border-bottom-color: #61afef; }
.content pre {
  background: #141a22;
  color: #bccad8;
  padding: 1rem;
  border-radius: 0;
  border: 1px solid #252c36;
  overflow-x: auto;
}
.content code {
  background: #232831;
  color: #c94d4d;
  padding: 0.15em 0.35em;
  border-radius: 0;
  font-size: 0.9em;
}
.content pre code {
  background: none;
  padding: 0;
  color: inherit;
}
.content img {
  max-width: 100%; height: auto; border-radius: 0; margin: 0.75em 0;
  display: block; border: 1px solid #283345;
}
.content table {
  border-collapse: collapse;
  margin: 1em 0;
  width: 100%;
}
.content th, .content td {
  border: 1px solid #283345;
  padding: 0.5em 0.75em;
}
.content th {
  background: #1a1e24;
  color: #c14343;
  font-family: 'Calisto MT', 'Book Antiqua', Georgia, serif;
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.content td { color: #97a1b9; }
.content blockquote {
  border-left: 3px solid #863737;
  padding: 0.75em 1em;
  color: #9a9088;
  margin: 1.25em 0;
  font-style: italic;
  background: rgba(101,33,33,0.05);
  border-radius: 0 6px 6px 0;
}
.content ul, .content ol {
  margin-left: 1.5rem; margin-bottom: 0.75em;
}
.content li { margin-bottom: 0.25em; }
.content hr {
  border: none;
  height: 2px;
  background: linear-gradient(90deg, #c14343 0%, #652121 40%, transparent 100%);
  margin: 2.5rem 0;
  border-radius: 0;
}
.content em { color: #97a1b9; }

/* Note Last Updated */
.note-last-updated {
  font-family: 'Calisto MT', 'Book Antiqua', Georgia, serif;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #586477;
  margin-bottom: 0;
}

/* Featured Characters Row */
.featured-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 1rem 0 0.5rem;
  margin-bottom: 0.5rem;
}
.featured-char {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.featured-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #c14343;
  box-shadow: 0 0 8px rgba(193,67,67,0.25);
  transition: transform 0.15s, box-shadow 0.15s;
}
.featured-icon:hover {
  transform: scale(1.1);
  box-shadow: 0 0 14px rgba(193,67,67,0.45);
}
.featured-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Calisto MT', 'Book Antiqua', Georgia, serif;
  font-weight: 700;
  font-size: 1.2rem;
  color: #e5ebee;
}
.featured-diamond {
  color: #c14343;
  font-size: 0.5rem;
  opacity: 0.6;
  margin: 0 0.15rem;
  align-self: center;
}

/* DM Controls */
.dm-controls {
  margin-bottom: 0.75rem;
}
.dm-controls button {
  margin-right: 0.25rem;
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
  cursor: pointer;
  background: #232831;
  color: #c14343;
  border: 1px solid #283345;
  border-radius: 0;
  font-family: 'Calisto MT', 'Book Antiqua', Georgia, serif;
  transition: background 0.15s;
}
.dm-controls button:hover { background: #283345; }

/* DM Editor */
.dm-main { flex: 1; display: flex; flex-direction: column; background: #141a22; }
.dm-editor { flex: 1; display: flex; flex-direction: column; }
.editor-toolbar {
  padding: 0.5rem; background: #1a1e24; display: flex; gap: 0.5rem; align-items: center;
  border-bottom: 1px solid #283345;
}
.editor-toolbar span { color: #c94d4d; font-family: 'Calisto MT', 'Book Antiqua', Georgia, serif; font-size: 0.9rem; }
.editor-toolbar button {
  padding: 0.3rem 0.75rem; cursor: pointer; background: #232831; color: #c14343;
  border: 1px solid #283345; border-radius: 0; font-family: 'Calisto MT', 'Book Antiqua', Georgia, serif; font-size: 0.8rem;
  transition: background 0.15s;
}
.editor-toolbar button:hover { background: #283345; }
.editor-split { flex: 1; display: flex; gap: 1rem; padding: 0.5rem; }
.md-input {
  flex: 1; font-family: 'Inter', monospace; font-size: 0.95rem; padding: 0.75rem;
  border: 1px solid #283345; resize: none; background: #0d1117; color: #bccad8; border-radius: 0;
}
.md-preview {
  flex: 1; padding: 0.75rem; overflow-y: auto; border: 1px solid #283345;
  background: #0b0f13; color: #bccad8; border-radius: 0;
}

/* Profile Modal */
.modal {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.85); display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.modal-content {
  background: #161b22; padding: 2rem; border-radius: 0; min-width: 300px; max-width: 450px;
  border: 1px solid #283345; box-shadow: 0 8px 32px rgba(0,0,0,0.7);
}
.modal-content h3 {
  margin-bottom: 1rem; font-family: 'Calisto MT', 'Book Antiqua', Georgia, serif; color: #c94d4d;
}
.profile-btn {
  display: flex; align-items: center; width: 100%; padding: 0.75rem 1rem; margin-bottom: 0.5rem;
  text-align: left; background: #1a1e24; border: none; border-left: 4px solid #863737;
  cursor: pointer; font-size: 1rem; border-radius: 0; color: #bccad8;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; transition: background 0.15s;
}
.profile-btn:hover { background: #232831; }

/* Profile Icon */
.profile-icon-small {
  width: 24px; height: 24px; max-width: 24px; max-height: 24px; min-width: 24px;
  border-radius: 50%; vertical-align: middle; margin-right: 0.25rem;
  object-fit: cover; border: 1px solid #283345; flex-shrink: 0;
}
.profile-icon-large {
  width: 48px; height: 48px; border-radius: 50%; vertical-align: middle; margin-right: 0.75rem;
  object-fit: cover; border: 2px solid #c14343;
}

/* Discussion Section */
.discussion-section {
  margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid #283345;
}
.discussion-title {
  margin-bottom: 1rem; color: #c14343; font-family: 'Calisto MT', 'Book Antiqua', Georgia, serif; font-weight: 600;
}
.comment {
  padding: 0.75rem; margin-bottom: 0.5rem; background: #1a1e24; border-radius: 0;
  border: 1px solid #252c36;
}
.comment-header { font-size: 0.85rem; margin-bottom: 0.35rem; display: flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; }
.comment-time { color: #4e5b6f; font-size: 0.8rem; margin-left: 0.5rem; }
.comment-body { font-size: 0.95rem; color: #97a1b9; }
.comment-body img.comment-image {
  max-width: 100%; height: auto; border-radius: 0; margin: 0.5em 0; display: block;
  border: 1px solid #283345;
}
.no-comments { color: #4e5b6f; font-style: italic; }

/* Comment Form */
.comment-form { margin-top: 1rem; }
.comment-profile-info { margin-bottom: 0.5rem; font-size: 0.9rem; color: #97a1b9; }
.comment-input-wrap { position: relative; }
.comment-form textarea {
  width: 100%; padding: 0.6rem; border: 1px solid #283345; border-radius: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 0.95rem; resize: vertical;
  background: #0d1117; color: #bccad8;
}
.comment-form textarea::placeholder { color: #4e5b6f; }
.comment-form textarea:focus { border-color: #863737; outline: none; }
.comment-form button {
  margin-top: 0.5rem; padding: 0.5rem 1.2rem; background: #c14343; color: #e5ebee;
  border: none; border-radius: 0; cursor: pointer; font-size: 0.9rem;
  font-family: 'Calisto MT', 'Book Antiqua', Georgia, serif; font-weight: 600; transition: background 0.15s;
}
.comment-form button:hover { background: #c94d4d; }

/* Wiki Links + Autocomplete */
.wiki-link {
  color: #61afef; text-decoration: none; border-bottom: 1px dashed rgba(97,175,239,0.4);
  transition: color 0.15s, border-color 0.15s;
}
.wiki-link:hover { color: #7ec4ff; border-bottom-color: #7ec4ff; }
.wiki-autocomplete {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 50;
  background: #1a1e24; border: 1px solid #283345; border-radius: 0;
  max-height: 200px; overflow-y: auto; box-shadow: 0 4px 16px rgba(0,0,0,0.6);
  font-size: 0.85rem;
}
.wiki-suggest {
  padding: 0.4rem 0.7rem; cursor: pointer; color: #97a1b9;
}
.wiki-suggest:hover, .wiki-suggest.active {
  background: #232831; color: #c94d4d;
}

/* Profile Manager (DM) */
.profile-manager {
  padding: 1.5rem; border-top: 1px solid #283345; margin-top: 1rem;
}
.profile-manager h3 {
  font-family: 'Calisto MT', 'Book Antiqua', Georgia, serif; color: #c94d4d; margin-bottom: 1rem;
}
.profile-form {
  display: flex; gap: 0.5rem; align-items: center; margin-bottom: 1rem;
}
.profile-form input[type="text"] {
  padding: 0.4rem 0.5rem; border: 1px solid #283345; border-radius: 0; flex: 1;
  background: #0d1117; color: #bccad8; font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.profile-form input[type="text"]:focus { border-color: #863737; outline: none; }
.profile-form button {
  padding: 0.4rem 0.75rem; cursor: pointer; background: #c14343; color: #e5ebee;
  border: none; border-radius: 0; font-family: 'Calisto MT', 'Book Antiqua', Georgia, serif; font-weight: 600;
  transition: background 0.15s;
}
.profile-form button:hover { background: #c94d4d; }
.profile-item {
  display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem;
  background: #1a1e24; border: 1px solid #252c36; border-radius: 0; margin-bottom: 0.35rem;
}
.icon-upload-label {
  font-size: 0.8rem; cursor: pointer; color: #61afef;
}
.icon-upload-input { display: none; }
.btn-delete-profile {
  margin-left: auto; padding: 0.2rem 0.5rem; font-size: 0.8rem; cursor: pointer;
  background: #863737; color: #c94d4d; border: none; border-radius: 0;
  transition: background 0.15s;
}
.btn-delete-profile:hover { background: #a53030; }

/* Profile Edit Button (DM) */
.btn-edit-profile {
  padding: 0.2rem 0.5rem; font-size: 0.8rem; cursor: pointer;
  background: #232831; color: #c14343; border: 1px solid #283345; border-radius: 0;
  transition: background 0.15s;
}
.btn-edit-profile:hover { background: #283345; }

/* DM Discussion Panel */
.dm-discussion {
  padding: 0.75rem; border-top: 1px solid #283345;
}
.dm-discussion h4 { margin-bottom: 0.5rem; color: #c14343; font-family: 'Calisto MT', 'Book Antiqua', Georgia, serif; }
.dm-comment-delete {
  padding: 0.15rem 0.4rem; font-size: 0.75rem; cursor: pointer;
  background: #863737; color: #c94d4d; border: none; border-radius: 0;
  margin-left: 0.5rem; transition: background 0.15s;
}
.dm-comment-delete:hover { background: #a53030; }

/* Sidebar Toggle (mobile) */
.sidebar-toggle {
  display: none; position: fixed; top: 0.5rem; left: 0.5rem;
  z-index: 200; background: #0d1117; color: #c14343;
  border: 1px solid #283345; font-size: 1.5rem;
  padding: 0.35rem 0.7rem;
  line-height: 1;
  border-radius: 0; cursor: pointer;
  min-width: 44px; min-height: 44px;
}

/* Responsive Layout */
@media (max-width: 768px) {
  .sidebar {
    position: fixed; left: -280px; top: 0; height: 100vh;
    z-index: 100; transition: left 0.2s ease;
  }
  .sidebar.open { left: 0; }
  .sidebar-banner { max-height: 100px; }
  .sidebar-banner img { max-height: 100px; }
  .sidebar-toggle { display: block; }
  .content {
    max-width: 100%;
    padding: 3.25rem 1rem 1.5rem;
  }
  .content h1 { font-size: 1.85rem; }
  .content h2 { font-size: 1.35rem; }
  .content h3 { font-size: 1.1rem; }
  .content pre, .content table { font-size: 0.85rem; }
  .editor-split { flex-direction: column; }
  .md-input, .md-preview { min-height: 200px; }
}

/* DM Login Page */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 1rem;
}
.login-card {
  background: #161b22; padding: 2.5rem; border-radius: 0;
  border: 1px solid #283345; box-shadow: 0 8px 32px rgba(0,0,0,0.7);
  max-width: 380px; width: 100%; text-align: center;
}
.login-title {
  font-family: 'Calisto MT', 'Book Antiqua', Georgia, serif; font-size: 1.8rem; color: #c14343;
  margin-bottom: 0.25rem; letter-spacing: 0.04em;
}
.login-subtitle {
  color: #586477; font-size: 0.9rem; margin-bottom: 1.5rem;
}
.login-error {
  background: rgba(101,33,33,0.2); color: #7ec4ff; padding: 0.5rem 0.75rem;
  border-radius: 0; border: 1px solid #863737; margin-bottom: 1rem;
  font-size: 0.9rem;
}
.login-input {
  width: 100%; padding: 0.65rem 0.75rem; border: 1px solid #283345;
  border-radius: 0; background: #0d1117; color: #bccad8;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 1rem;
  margin-bottom: 1rem;
}
.login-input:focus { border-color: #c14343; outline: none; }
.login-btn {
  width: 100%; padding: 0.6rem; background: #c14343; color: #e5ebee;
  border: none; border-radius: 0; cursor: pointer; font-size: 1rem;
  font-family: 'Calisto MT', 'Book Antiqua', Georgia, serif; font-weight: 600;
  transition: background 0.15s;
}
.login-btn:hover { background: #c94d4d; }
.login-back {
  display: inline-block; margin-top: 1rem; color: #586477; font-size: 0.85rem;
  text-decoration: none; transition: color 0.15s;
}
.login-back:hover { color: #c94d4d; }

/* Search */
.search-input {
  width: 100%;
  padding: 0.45rem 0.6rem;
  margin-bottom: 0.75rem;
  border: 1px solid #283345;
  border-radius: 0;
  background: #141a22;
  color: #bccad8;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.9rem;
}
.search-input::placeholder { color: #4e5b6f; }
.search-input:focus { border-color: #c14343; outline: none; }
.search-results {
  list-style: none;
  padding: 0;
  margin: 0 0 0.75rem 0;
}
.search-result-item {
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid #1a1e24;
  cursor: pointer;
  border-radius: 0;
  transition: background 0.15s;
}
.search-result-item:hover { background: rgba(193,67,67,0.08); }
.search-result-title {
  color: #c94d4d;
  font-family: 'Calisto MT', 'Book Antiqua', Georgia, serif;
  font-size: 0.85rem;
  font-weight: 600;
}
.search-result-snippet {
  color: #586477;
  font-size: 0.8rem;
  margin-top: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Note Tags */
.note-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}
.note-tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
  font-family: 'Calisto MT', 'Book Antiqua', Georgia, serif;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #c14343;
  background: rgba(193,67,67,0.1);
  border: 1px solid rgba(193,67,67,0.25);
  border-radius: 0;
}

/* Note Status Banner */
.note-status {
  font-family: 'Calisto MT', 'Book Antiqua', Georgia, serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: center;
  padding: 0.6rem 1rem;
  margin-bottom: 1rem;
  border-radius: 0;
}
.note-status-missing {
  color: #7ec4ff;
  background: rgba(101,33,33,0.15);
  border: 1px solid rgba(101,33,33,0.4);
}
.note-status-dead {
  color: #666;
  background: rgba(100,100,100,0.1);
  border: 1px solid rgba(100,100,100,0.3);
}
.note-status-active {
  color: #2ecc71;
  background: rgba(46,204,113,0.1);
  border: 1px solid rgba(46,204,113,0.3);
}
.note-status-wanted {
  color: #e67e22;
  background: rgba(230,126,34,0.1);
  border: 1px solid rgba(230,126,34,0.3);
}
.note-status-killed {
  color: #e74c3c;
  background: rgba(231,76,60,0.1);
  border: 1px solid rgba(231,76,60,0.3);
}
.note-status-unknown {
  color: #a855f7;
  background: rgba(168,85,247,0.1);
  border: 1px solid rgba(168,85,247,0.3);
}

/* Backlinks */
.backlinks-section {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #283345;
}
.backlinks-section h4 {
  font-family: 'Calisto MT', 'Book Antiqua', Georgia, serif;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #586477;
  margin-bottom: 0.5rem;
}
.backlink-item {
  display: block;
  padding: 0.25rem 0.4rem;
  color: #61afef;
  text-decoration: none;
  font-size: 0.9rem;
  border-radius: 0;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
}
.backlink-item:hover {
  background: rgba(97,175,239,0.08);
  color: #7ec4ff;
}

/* Bookmark Button */
.bookmark-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #c14343;
  cursor: pointer;
  padding: 0.1rem 0.3rem;
  line-height: 1;
  transition: transform 0.15s, color 0.15s;
  float: right;
}
.bookmark-btn:hover {
  transform: scale(1.2);
  color: #c94d4d;
}

/* Bookmarks Section (sidebar) */
.bookmarks-section {
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #283345;
}
.bookmarks-title {
  margin-bottom: 0.3rem;
  font-size: 0.78rem;
  color: #c14343;
  font-family: 'Calisto MT', 'Book Antiqua', Georgia, serif;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.3rem 0;
}
.bookmark-glyph {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI Symbol', sans-serif;
  font-size: 0.9em;
}
.bookmark-btn {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI Symbol', sans-serif;
}
.bookmarks-section ul {
  list-style: none;
  padding-left: 0.4rem;
}
.bookmark-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.15rem 0.3rem;
  border-radius: 0;
}
.bookmark-item a {
  color: #586477;
  text-decoration: none;
  font-size: 0.9rem;
  flex: 1;
  transition: color 0.15s;
}
.bookmark-item a:hover {
  color: #c94d4d;
}
.bookmark-remove {
  color: #863737;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0 0.25rem;
  transition: color 0.15s;
}
.bookmark-remove:hover {
  color: #61afef;
}

/* ===== Dark PHB Note Layout ===== */

/* Single-column reading flow - keeps tables and long content readable. */
.note-body {
  /* (was column-count: 2; reverted - tables and code blocks were unreadable) */
}

/* PHB-style decorative headers */
.note-body h2 {
  border-bottom: 2px solid #863737;
  padding-bottom: 0.25em;
  margin-top: 1.5em;
}
.note-body h3 {
  position: relative;
  padding-bottom: 0.2em;
}
.note-body h3::after {
  content: '';
  display: block;
  margin-top: 0.25em;
  height: 1px;
  background: linear-gradient(90deg, #863737 0%, transparent 80%);
}

/* PHB-style decorative horizontal rule */
.note-body hr {
  border: none;
  height: 0;
  margin: 1.5rem 0;
  position: relative;
  overflow: visible;
}
.note-body hr::before {
  content: '✦ ✦ ✦';
  display: block;
  text-align: center;
  color: #863737;
  font-size: 0.65rem;
  letter-spacing: 0.5em;
}
.note-body hr::after {
  content: '';
  display: block;
  margin-top: 0.3em;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, #863737 30%, #c14343 50%, #863737 70%, transparent 100%);
  border-radius: 0;
}

/* Drop cap on first paragraph after h1 */
.note-body h1 + p::first-letter {
  float: left;
  font-family: 'Calisto MT', 'Book Antiqua', Georgia, serif;
  font-size: 3.2em;
  line-height: 0.8;
  padding-right: 0.08em;
  color: #c14343;
  font-weight: 700;
}

/* Stat-block style blockquotes */
.note-body blockquote {
  break-inside: avoid;
  background: rgba(30, 22, 14, 0.7);
  border: 1px solid #3a2a1a;
  border-left: 3px solid #863737;
  border-radius: 0;
  padding: 0.75em 1em;
  margin: 1em 0;
  font-style: italic;
  color: #97a1b9;
  position: relative;
}
.note-body blockquote::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, #863737, #c14343, #863737);
}
.note-body blockquote::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, #863737, #c14343, #863737);
}

/* PHB-style table with alternating rows */
.note-body table {
  break-inside: avoid;
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  font-size: 0.92rem;
}
.note-body th {
  background: #1a1210;
  color: #c14343;
  font-family: 'Calisto MT', 'Book Antiqua', Georgia, serif;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid #863737;
  padding: 0.45em 0.6em;
  text-align: left;
}
.note-body td {
  padding: 0.35em 0.6em;
  border: none;
  border-bottom: 1px solid #1a1210;
  color: #97a1b9;
}
.note-body tr:nth-child(odd) td {
  background: rgba(30, 22, 14, 0.4);
}
.note-body tr:nth-child(even) td {
  background: rgba(20, 15, 10, 0.3);
}

/* Lists — slightly tighter for PHB feel */
.note-body ul, .note-body ol {
  margin-left: 1.2rem;
  margin-bottom: 0.6em;
}
.note-body li {
  margin-bottom: 0.2em;
  line-height: 1.5;
}
.note-body li::marker {
  color: #863737;
}

/* Bold text accent color */
.note-body strong {
  color: #c94d4d;
  letter-spacing: -0.01em;
}

/* Images within columns */
.note-body img {
  max-width: 100%;
  height: auto;
  border-radius: 0;
  margin: 0.75em 0;
  display: block;
  border: 2px solid #2f3b4d;
  box-shadow: 0 2px 12px rgba(0,0,0,0.5);
}

/* Forgotten Realms-style infobox (floated right) */
.note-body .infobox {
  float: right;
  width: clamp(280px, 32%, 460px);
  margin: 0 0 1rem 1.5rem;
  padding: 0;
  background: #15191f;
  border: 1px solid #3a2a1a;
  box-shadow: 0 2px 12px rgba(0,0,0,0.6);
  font-size: 0.9rem;
}
.note-body .infobox .infobox-title,
.note-body .infobox > h2:first-child,
.note-body .infobox > h3:first-child {
  margin: 0;
  padding: 0.5em 0.75em;
  background: linear-gradient(180deg, #2a1a14 0%, #1a1210 100%);
  border-bottom: 2px solid #863737;
  color: #c14343;
  font-family: 'Calisto MT', 'Book Antiqua', Georgia, serif;
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.05em;
}
.note-body .infobox > h2:first-child::after,
.note-body .infobox > h3:first-child::after {
  display: none;
}
.note-body .infobox img {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  object-position: top center;
  margin: 0;
  border: none;
  border-bottom: 1px solid #3a2a1a;
  box-shadow: none;
}
.note-body .infobox p {
  margin: 0;
  padding: 0.4em 0.75em;
  text-align: center;
  font-style: italic;
  color: #97a1b9;
  border-bottom: 1px solid #1a1210;
}
.note-body .infobox table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.note-body .infobox table th,
.note-body .infobox table td {
  padding: 0.35em 0.6em;
  border: none;
  border-bottom: 1px solid #1a1210;
  vertical-align: top;
  background: transparent;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.82rem;
  font-family: inherit;
}
.note-body .infobox table th {
  width: 38%;
  color: #c14343;
  text-align: left;
  font-weight: 600;
  background: rgba(30, 22, 14, 0.5);
}
.note-body .infobox table td {
  color: #c9d1e0;
}
.note-body .infobox table tr:last-child th,
.note-body .infobox table tr:last-child td {
  border-bottom: none;
}
@media (max-width: 720px) {
  .note-body .infobox {
    float: none;
    width: 100%;
    margin: 0 0 1rem 0;
  }
}

/* Infobox expandable status section */
.note-body .infobox details {
  margin: 0;
  border-top: 1px solid #3a2a1a;
}
.note-body .infobox details summary {
  cursor: pointer;
  padding: 0.45em 0.6em;
  font-weight: 600;
  font-size: 0.82rem;
  color: #c14343;
  background: rgba(30, 22, 14, 0.5);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.4em;
}
.note-body .infobox details summary::-webkit-details-marker {
  display: none;
}
.note-body .infobox details summary::before {
  content: '\25B6';
  font-size: 0.6em;
  transition: transform 0.2s ease;
}
.note-body .infobox details[open] summary::before {
  transform: rotate(90deg);
}
.note-body .infobox details .status-details {
  padding: 0.4em 0.6em;
  font-size: 0.82rem;
  color: #c9d1e0;
  background: #15191f;
}
.note-body .infobox details .status-details table {
  margin: 0;
}

/* ===== End Dark PHB ===== */

/* History Panel (DM) */
.dm-history {
  padding: 0.75rem;
  border-top: 1px solid #283345;
  max-height: 250px;
  overflow-y: auto;
}
.dm-history h4 {
  margin-bottom: 0.5rem;
  color: #c14343;
  font-family: 'Calisto MT', 'Book Antiqua', Georgia, serif;
}
.history-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  margin-bottom: 0.25rem;
  background: #1a1e24;
  border-radius: 0;
  border: 1px solid #252c36;
}
.history-date {
  flex: 1;
  color: #97a1b9;
  font-size: 0.85rem;
}
.history-btn {
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  cursor: pointer;
  background: #232831;
  color: #c14343;
  border: 1px solid #283345;
  border-radius: 0;
  font-family: 'Calisto MT', 'Book Antiqua', Georgia, serif;
  transition: background 0.15s;
}
.history-btn:hover {
  background: #283345;
}

/* Page load spinner */
.page-loader { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; background: #0b0f13; transition: opacity 0.4s ease, visibility 0.4s ease; }
.page-loader.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.page-loader-icon { width: 96px; height: 96px; animation: page-loader-spin 1.6s linear infinite; filter: drop-shadow(0 0 12px rgba(193, 67, 67, 0.4)); }
@keyframes page-loader-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .page-loader-icon { animation: none; } }

