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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #0a0c10;
  color: #e8ecf0;
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: #60a5fa;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.main-wrap {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main {
  flex: 1;
  padding: 0 40px;
  max-width: 1200px;
}

.sidebar {
  background: #0f1218;
  border-right: 1px solid #1a1e26;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #1a1e26 transparent;
}

.sidebar .site-name {
  font-weight: 700;
  font-size: 18px;
  padding: 0 12px;
  margin-bottom: 32px;
  letter-spacing: -0.5px;
}

.sidebar .section {
  margin-bottom: 24px;
}

.sidebar .section .label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #5a6a7a;
  padding: 0 12px;
  margin-bottom: 8px;
}

.sidebar .section ul {
  list-style: none;
}

.sidebar .section ul li {
  font-size: 13px;
  font-weight: 500;
  padding: 0;
  border-radius: 6px;
  transition: all 0.15s;
}

.sidebar .section ul li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  color: #7a8a9a;
  border-radius: 6px;
  transition: all 0.15s;
  text-decoration: none;
}

.sidebar .section ul li a i {
  width: 16px;
  text-align: center;
  font-size: 14px;
}

.sidebar .section ul li a:hover {
  background: #1a1e26;
  color: #e8ecf0;
}

.sidebar .section ul li.active a {
  background: #1a1e26;
  color: #e8ecf0;
}

/* ---- Main Content ---- */

.main {
  padding: 0 40px 32px;
  overflow-y: auto;
  max-width: 1200px;
}

/* ---- Menu Bar ---- */

.menu-bar-wrap {
  background: #0f1218;
  border-bottom: 1px solid #1a1e26;
  padding: 0 24px;
  margin-bottom: 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  height: 44px;
}

.menu-list {
  display: flex;
  align-items: center;
  list-style: none;
  gap: 4px;
  margin-left: auto;
}

.menu-item {
  position: relative;
  font-size: 13px;
  font-weight: 500;
}

.menu-item > a,
.menu-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  color: #7a8a9a;
  text-decoration: none;
  border-radius: 6px;
  transition: all 0.15s;
  cursor: pointer;
  white-space: nowrap;
}

.menu-item > a:hover,
.menu-link:hover {
  background: #1a1e26;
  color: #e8ecf0;
}

.menu-arrow {
  font-size: 10px;
  margin-left: 2px;
}

.menu-dropdown-list {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 180px;
  background: #0f1218;
  border: 1px solid #1a1e26;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  padding: 6px;
  list-style: none;
  z-index: 100;
}

.menu-dropdown:hover .menu-dropdown-list {
  display: block;
}

.menu-dropdown-list li a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: #7a8a9a;
  text-decoration: none;
  border-radius: 6px;
  font-size: 13px;
  transition: all 0.15s;
}

.menu-dropdown-list li a:hover {
  background: #1a1e26;
  color: #e8ecf0;
}

.menu-social {
  margin-left: auto;
}

.menu-social a {
  font-size: 16px;
  padding: 8px 10px;
}

.menu-social a i {
  vertical-align: middle;
  line-height: 1;
}

/* ---- Top Bar ---- */

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  gap: 12px;
}

.top-bar h1 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.3px;
  flex: 1;
}

.search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: #5a6a7a;
  padding: 6px 28px 6px 12px;
  cursor: pointer;
  font-size: 14px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  transition: color 0.15s;
  white-space: nowrap;
  border-right: 1px solid #1a1e26;
  margin-right: 24px;
}

.search-trigger:hover {
  color: #8a9aaa;
}

.search-trigger i {
  font-size: 15px;
}

.search-hint {
  font-size: 13px;
}

.search-kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  background: #1a1e26;
  border: 1px solid #2a2e36;
  border-radius: 4px;
  padding: 2px 6px;
  color: #7a8a9a;
}

.menu-toggle {
  display: none;
  background: none;
  border: 1px solid #1a1e26;
  color: #7a8a9a;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
}

/* ---- Content ---- */

.content h1 { font-size: 26px; font-weight: 700; margin-bottom: 16px; letter-spacing: -0.5px; }
.content h2 { font-size: 20px; font-weight: 600; margin-top: 32px; margin-bottom: 12px; letter-spacing: -0.3px; }
.content h3 { font-size: 16px; font-weight: 600; margin-top: 24px; margin-bottom: 8px; }
.content h4 { font-size: 14px; font-weight: 600; margin-top: 20px; margin-bottom: 8px; }
.content h5, .content h6 { font-size: 13px; font-weight: 600; margin-top: 16px; margin-bottom: 6px; }

.content p {
  color: #8a9aaa;
  margin-bottom: 16px;
}

.content ul, .content ol {
  color: #8a9aaa;
  margin-bottom: 16px;
  padding-left: 24px;
}

.content li {
  margin-bottom: 4px;
}

.content li > ul, .content li > ol {
  margin-bottom: 0;
  margin-top: 4px;
}

.content blockquote {
  border-left: 3px solid #3b82f6;
  background: #0f1218;
  padding: 12px 16px;
  margin-bottom: 16px;
  border-radius: 0 6px 6px 0;
  color: #8a9aaa;
}

.content blockquote p {
  margin-bottom: 0;
}

.content hr {
  border: none;
  border-top: 1px solid #1a1e26;
  margin: 24px 0;
}

/* ---- Code ---- */

.content code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  background: #0f1218;
  padding: 2px 6px;
  border-radius: 4px;
  color: #c8d0d8;
}

.content pre {
  background: #0f1218;
  border: 1px solid #1a1e26;
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.content pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: 13px;
  line-height: 1.6;
  color: #c8d0d8;
}

.content pre code .comment { color: #5a6a7a; }

/* ---- Tables ---- */

.content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  font-size: 13px;
}

.content th, .content td {
  padding: 8px 12px;
  text-align: left;
  border: 1px solid #1a1e26;
}

.content th {
  background: #0f1218;
  font-weight: 600;
  color: #e8ecf0;
}

.content td {
  color: #8a9aaa;
}

.content tr:nth-child(even) td {
  background: rgba(255,255,255,0.02);
}

/* ---- Task List ---- */

.content ul.task-list {
  list-style: none;
  padding-left: 0;
}

.content .task-list-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.content .task-list-item input[type="checkbox"] {
  accent-color: #3b82f6;
}

/* ---- Images ---- */

.content img {
  max-width: 100%;
  border-radius: 8px;
  margin: 16px 0;
}

/* ---- Foot Notes ---- */

.footnotes {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid #1a1e26;
  font-size: 13px;
  color: #5a6a7a;
}

.footnotes ol {
  padding-left: 20px;
}

/* ---- Footer ---- */

.footer {
  padding: 20px 40px;
  border-top: 1px solid #1a1e26;
  font-size: 12px;
  color: #5a6a7a;
  flex-shrink: 0;
}

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

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    z-index: 100;
    box-shadow: 4px 0 24px rgba(0,0,0,0.4);
  }

  .sidebar.open {
    display: flex;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .main {
    padding: 24px 20px;
  }

  .top-bar h1 {
    font-size: 18px;
  }

  .content h1 { font-size: 22px; }
  .content h2 { font-size: 18px; }

  .content pre {
    padding: 12px 16px;
  }

  .search-trigger .search-hint,
  .search-trigger .search-kbd {
    display: none;
  }

  .search-trigger {
    padding: 6px 10px;
    margin-right: 0;
    border-right: none;
  }

  .menu-bar-wrap {
    padding: 0 12px;
    overflow-x: visible;
  }

  .menu-list {
    gap: 0;
  }

  .menu-item > a,
  .menu-link {
    padding: 8px 10px;
    font-size: 12px;
  }

  .search-modal {
    margin: 0 16px;
    max-width: none;
    border-radius: 12px;
  }

  .search-modal-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .search-modal-input-wrap {
    min-width: 100%;
  }

  .search-mode-toggle {
    margin-left: 0;
  }

  .top-bar {
    margin-bottom: 20px;
  }

  .top-bar h1 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .footer {
    padding: 16px 20px;
  }

  .content table {
    display: block;
    overflow-x: auto;
  }

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

/* ---- Search Modal ---- */

.search-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 300;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}

.search-overlay.open {
  display: flex;
}

.search-modal {
  width: 100%;
  max-width: 640px;
  background: #0f1218;
  border: 1px solid #1a1e26;
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.search-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #1a1e26;
}

.search-modal-input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-modal-icon {
  color: #5a6a7a;
  font-size: 16px;
  flex-shrink: 0;
}

.search-modal-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: #e8ecf0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
}

.search-modal-input::placeholder {
  color: #5a6a7a;
}

.search-modal-close {
  background: none;
  border: none;
  color: #5a6a7a;
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s;
}

.search-modal-close:hover {
  color: #e8ecf0;
}

/* ── Search History ── */

.search-history {
  display: none;
  padding: 8px 16px;
  border-bottom: 1px solid #1a1e26;
}

.search-history-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #5a6a7a;
  margin-bottom: 6px;
}

.search-history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: none;
  border: none;
  color: #8a9aaa;
  padding: 7px 8px;
  border-radius: 5px;
  font-size: 13px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  cursor: pointer;
  text-align: left;
  transition: all 0.1s;
}

.search-history-item:hover {
  background: #1a1e26;
  color: #e8ecf0;
}

.search-history-item i {
  font-size: 12px;
  color: #5a6a7a;
  width: 16px;
  text-align: center;
}

/* ── Search Results ── */

.search-modal-results {
  max-height: 460px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #1a1e26 transparent;
}

.search-modal-results:empty {
  display: none;
}

.search-modal-empty {
  padding: 32px 16px;
  text-align: center;
  color: #5a6a7a;
  font-size: 14px;
}

.search-modal-result {
  display: block;
  padding: 12px 16px;
  color: #8a9aaa;
  text-decoration: none;
  font-size: 13px;
  border-bottom: 1px solid #1a1e26;
  transition: background 0.1s;
  cursor: pointer;
  overflow: hidden;
}

.search-modal-result:last-child {
  border-bottom: none;
}

.search-modal-result:hover,
.search-modal-result.active {
  background: #1a1e26;
}

.search-modal-result .result-title {
  font-weight: 600;
  color: #e8ecf0;
  display: block;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-modal-result .result-entry-page {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #5a6a7a;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.search-modal-result .result-entry-line {
  font-size: 13px;
  color: #8a9aaa;
  line-height: 1.5;
}

.search-modal-result .result-entry-line mark {
  background: rgba(59, 130, 246, 0.25);
  color: #93c5fd;
  border-radius: 2px;
  padding: 0 2px;
}

/* ---- Search Mode Toggle ---- */

.search-mode-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
}

.search-mode-btn {
  background: #1a1e26;
  border: 1px solid #2a2e36;
  color: #5a6a7a;
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 11px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.search-mode-btn:hover {
  border-color: #3b82f6;
  color: #8a9aaa;
}

.search-mode-btn.active {
  background: rgba(59, 130, 246, 0.15);
  border-color: #3b82f6;
  color: #60a5fa;
}

.search-private-btn {
  background: #1a1e26;
  border: 1px solid #2a2e36;
  color: #5a6a7a;
  padding: 4px 8px;
  border-radius: 5px;
  font-size: 14px;
  line-height: 1;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  cursor: pointer;
  transition: all 0.15s;
}

.search-private-btn:hover {
  border-color: #3b82f6;
  color: #8a9aaa;
}

.search-private-btn.active {
  background: rgba(59, 130, 246, 0.15);
  border-color: #3b82f6;
  color: #60a5fa;
}

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

.star-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: #3a4a5a;
  cursor: pointer;
  padding: 2px 4px;
  margin-left: 2px;
  border-radius: 3px;
  font-size: 13px;
  transition: all 0.15s;
  vertical-align: middle;
  opacity: 0;
}

.content li:hover .star-btn,
.star-btn.starred {
  opacity: 1;
}

.star-btn:hover {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.1);
}

.star-btn.starred {
  color: #fbbf24;
}

/* ---- Entry Highlight ---- */

.content li.entry-highlight {
  background: rgba(59, 130, 246, 0.08);
  border-radius: 4px;
  padding: 4px 8px;
  margin: 2px -8px;
  box-shadow: inset 2px 0 0 #3b82f6;
}

/* ---- Link Status Highlights ---- */

.content li.link-ok {
  border-left: 3px solid #22c55e;
  background: rgba(34, 197, 94, 0.04);
  padding-left: 8px;
}

.content li.link-error {
  border-left: 3px solid #eab308;
  background: rgba(234, 179, 8, 0.04);
  padding-left: 8px;
}

.content li.link-timeout {
  border-left: 3px solid #ef4444;
  background: rgba(239, 68, 68, 0.04);
  padding-left: 8px;
}

/* ---- Starred Page ---- */

.starred-empty-msg {
  color: #5a6a7a;
  text-align: center;
  padding: 40px 0;
  font-size: 14px;
}

.starred-ul {
  list-style: none;
  padding-left: 0;
}

.starred-li {
  padding: 12px 0;
  border-bottom: 1px solid #1a1e26;
  display: flex;
  align-items: center;
  gap: 10px;
}

.starred-li:last-child {
  border-bottom: none;
}

.starred-info {
  flex: 1;
  min-width: 0;
}

.starred-info a {
  display: block;
  color: #60a5fa;
  word-break: break-all;
  font-size: 14px;
}

.starred-info a:hover {
  text-decoration: underline;
}

.starred-source {
  display: inline-block !important;
  font-size: 12px !important;
  color: #5a6a7a !important;
  margin-top: 4px;
}

.starred-source:hover {
  color: #8a9aaa !important;
}

.starred-remove {
  background: none;
  border: none;
  color: #fbbf24;
  cursor: pointer;
  font-size: 14px;
  padding: 4px 8px;
  flex-shrink: 0;
}

.starred-remove:hover {
  color: #f59e0b;
}

/* ── Recommendation Section ── */

.rec-section-header {
  margin-bottom: 16px;
}

.rec-heading {
  font-size: 20px !important;
  font-weight: 600 !important;
  letter-spacing: -0.3px;
  margin-bottom: 0 !important;
}

.rec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.rec-card {
  display: block;
  background: #0f1218;
  border: 1px solid #1a1e26;
  border-radius: 8px;
  padding: 14px 16px;
  text-decoration: none;
  cursor: pointer;
}

.rec-card:hover {
  border-color: #3b82f6;
  background: #12161e;
  text-decoration: none;
}

.rec-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #e8ecf0;
  margin-bottom: 8px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rec-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.rec-card-cat {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #60a5fa;
  background: rgba(96, 165, 250, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
}

.rec-card-reason {
  font-size: 11px;
  color: #5a6a7a;
}

.rec-card-page {
  font-size: 12px;
  color: #5a6a7a;
  text-decoration: none;
  display: inline-block;
}

.rec-card-page:hover {
  color: #60a5fa;
  text-decoration: underline;
}

.rec-empty {
  color: #5a6a7a;
  font-size: 14px;
  padding: 24px 0;
  text-align: center;
}

.rec-empty code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  background: #0f1218;
  padding: 2px 6px;
  border-radius: 4px;
  color: #c8d0d8;
}

