:root {
  --bg: #fbfbfd;
  --bg-elevated: #ffffff;
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --border: rgba(0, 0, 0, 0.08);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.1);
  --radius: 18px;
  --radius-sm: 12px;
  --nav-height: 52px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  --transition: 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent-hover);
}

img {
  max-width: 100%;
  display: block;
}

/* Navigation */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: var(--nav-height);
  background: rgba(251, 251, 253, 0.8);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 22px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.mobile-menu-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.04);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  padding: 0;
  transition: background var(--transition);
}

.mobile-menu-toggle span {
  display: block;
  width: 16px;
  height: 1.5px;
  border-radius: 999px;
  background: var(--text);
  transition: transform var(--transition), opacity var(--transition);
}

.mobile-menu-toggle:hover,
.nav.mobile-open .mobile-menu-toggle {
  background: rgba(0, 0, 0, 0.08);
}

.nav.mobile-open .mobile-menu-toggle span:first-child {
  transform: translateY(3.25px) rotate(45deg);
}

.nav.mobile-open .mobile-menu-toggle span:last-child {
  transform: translateY(-3.25px) rotate(-45deg);
}

.nav-logo {
  font-size: 21px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.nav-logo:hover {
  color: var(--text);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  list-style: none;
}

.nav-links a {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 400;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* User menu */
.user-menu {
  position: relative;
}

.user-menu-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border: none;
  background: transparent;
  border-radius: 980px;
  cursor: pointer;
  font-family: var(--font);
  transition: background var(--transition);
}

.user-menu-trigger:hover,
.user-menu.open .user-menu-trigger {
  background: rgba(0, 0, 0, 0.05);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-name {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 160px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: all 0.2s ease;
  z-index: 200;
}

.user-menu.open .user-menu-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-menu-dropdown a {
  display: block;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
  border-radius: 8px;
  transition: background var(--transition);
}

.user-menu-dropdown a:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
}

.user-menu-logout {
  color: var(--text-secondary) !important;
  border-top: 1px solid var(--border);
  margin-top: 4px;
  padding-top: 10px !important;
  border-radius: 0 0 8px 8px !important;
}

@media (max-width: 768px) {
  .user-name {
    display: none;
  }
}

.search-form {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 980px;
  padding: 6px 14px;
  gap: 6px;
  transition: background var(--transition);
}

.search-form:focus-within {
  background: rgba(0, 0, 0, 0.06);
}

.search-form input {
  border: none;
  background: transparent;
  font-family: var(--font);
  font-size: 14px;
  width: 140px;
  outline: none;
  color: var(--text);
}

.search-form button {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-tertiary);
  font-size: 14px;
  padding: 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: 980px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
}

.btn-secondary {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
}

.btn-secondary:hover {
  background: rgba(0, 0, 0, 0.08);
  color: var(--text);
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
  padding: 10px 16px;
}

.btn-ghost:hover {
  background: rgba(0, 113, 227, 0.08);
  color: var(--accent);
}

.btn-danger {
  background: #ff3b30;
  color: #fff;
}

.btn-danger:hover {
  background: #ff453a;
  color: #fff;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

/* Layout */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 22px;
}

.section {
  padding: 80px 0;
}

.section-header {
  text-align: center;
  margin-bottom: 56px;
}

.section-header h2 {
  font-size: 48px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.08;
  margin-bottom: 12px;
}

.section-header p {
  font-size: 21px;
  color: var(--text-secondary);
  font-weight: 400;
}

/* Hero */
.hero {
  text-align: center;
  padding: 100px 22px 80px;
  max-width: 800px;
  margin: 0 auto;
}

.hero h1 {
  font-size: clamp(40px, 6vw, 64px);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #1d1d1f 0%, #424245 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: clamp(17px, 2.5vw, 21px);
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 32px;
}

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.card {
  background: var(--bg-elevated);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
  border: 1px solid var(--border);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.card-image {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #f5f5f7;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.card:hover .card-image img {
  transform: scale(1.04);
}

.card-body {
  padding: 24px;
}

.card-tag {
  display: inline-block;
  font-size: 12px;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.card-title {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  color: var(--text);
}

.card-title a {
  color: inherit;
}

.card-title a:hover {
  color: var(--accent);
}

.card-excerpt {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 980px;
  font-size: 11px;
  font-weight: 500;
}

.badge-public {
  background: rgba(52, 199, 89, 0.12);
  color: #248a3d;
}

.badge-private {
  background: rgba(255, 149, 0, 0.12);
  color: #c93400;
}

/* Photo grid */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.photo-item {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 1;
  background: #f5f5f7;
  cursor: pointer;
}

.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.photo-item:hover img {
  transform: scale(1.06);
}

.photo-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 50%, rgba(0, 0, 0, 0.5));
  opacity: 0;
  transition: opacity var(--transition);
  display: flex;
  align-items: flex-end;
  padding: 16px;
}

.photo-item:hover .photo-overlay {
  opacity: 1;
}

.photo-overlay span {
  color: #fff;
  font-size: 14px;
  font-weight: 500;
}

/* Article detail */
.article-hero {
  padding: 60px 0 40px;
  text-align: center;
  max-width: 720px;
  margin: 0 auto;
}

.article-hero h1 {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 16px;
}

.article-meta {
  font-size: 14px;
  color: var(--text-tertiary);
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.article-cover {
  max-width: 900px;
  margin: 0 auto 48px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.article-content {
  max-width: 680px;
  margin: 0 auto;
  font-size: 18px;
  line-height: 1.7;
  color: var(--text);
  padding-bottom: 80px;
}

.article-content p {
  margin-bottom: 1.4em;
}

.article-content h2 {
  font-size: 28px;
  font-weight: 600;
  margin: 2em 0 0.8em;
  letter-spacing: -0.02em;
}

.article-content h3 {
  font-size: 22px;
  font-weight: 600;
  margin: 1.6em 0 0.6em;
}

.article-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 16px;
}

.tag {
  padding: 4px 12px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 980px;
  font-size: 13px;
  color: var(--text-secondary);
}

/* Photo detail */
.photo-detail {
  padding: 60px 0 80px;
  text-align: center;
}

.photo-detail img {
  max-width: 900px;
  margin: 0 auto 32px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.photo-detail h1 {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.photo-detail p {
  font-size: 17px;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* Search results */
.search-header {
  text-align: center;
  padding: 60px 0 40px;
}

.search-header h1 {
  font-size: 40px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.search-header .query {
  color: var(--accent);
}

.search-empty {
  text-align: center;
  padding: 60px 0;
  color: var(--text-secondary);
  font-size: 17px;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 48px;
}

.pagination a,
.pagination span {
  padding: 8px 16px;
  border-radius: 980px;
  font-size: 14px;
  color: var(--text-secondary);
}

.pagination a:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
}

.pagination .current {
  background: var(--accent);
  color: #fff;
}

/* Flash messages */
.flash-messages {
  position: fixed;
  top: calc(var(--nav-height) + 12px);
  right: 22px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.flash {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.4s ease;
}

.flash-success {
  background: #fff;
  color: #248a3d;
  border: 1px solid rgba(52, 199, 89, 0.3);
}

.flash-error {
  background: #fff;
  color: #d70015;
  border: 1px solid rgba(255, 59, 48, 0.3);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Login */
.auth-page {
  min-height: calc(100vh - var(--nav-height));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 22px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  padding: 48px 40px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

.auth-card h1 {
  font-size: 32px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.auth-card .subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 32px;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

textarea.form-control {
  min-height: 160px;
  resize: vertical;
  line-height: 1.6;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.form-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.form-check label {
  font-size: 14px;
  color: var(--text);
  margin: 0;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
}

.form-actions .btn {
  flex: 1;
}

/* Admin */
.admin-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: calc(100vh - var(--nav-height));
}

.admin-sidebar {
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  padding: 32px 0;
}

.admin-sidebar h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  padding: 0 24px;
  margin-bottom: 12px;
}

.admin-nav {
  list-style: none;
}

.admin-nav a {
  display: block;
  padding: 10px 24px;
  font-size: 14px;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.admin-nav a:hover,
.admin-nav a.active {
  color: var(--text);
  background: rgba(0, 0, 0, 0.04);
}

.admin-content {
  padding: 40px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.admin-header h1 {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}

.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 24px;
}

.stat-card .value {
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.stat-card .label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

.admin-table th,
.admin-table td {
  padding: 14px 20px;
  text-align: left;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

.admin-table th {
  font-weight: 500;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.02);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.admin-table .actions {
  display: flex;
  gap: 8px;
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 40px 22px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13px;
}

.footer p + p {
  margin-top: 8px;
}

.footer-icp a {
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color var(--transition);
}

.footer-icp a:hover {
  color: var(--text-secondary);
}

/* Error pages */
.error-page {
  text-align: center;
  padding: 120px 22px;
}

.error-page h1 {
  font-size: 72px;
  font-weight: 600;
  letter-spacing: -0.04em;
  margin-bottom: 16px;
}

.error-page p {
  font-size: 19px;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

/* Fade-in animation */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeIn 0.8s ease forwards;
}

.fade-in:nth-child(2) { animation-delay: 0.1s; }
.fade-in:nth-child(3) { animation-delay: 0.2s; }
.fade-in:nth-child(4) { animation-delay: 0.3s; }

@keyframes fadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */
@media (max-width: 768px) {
  :root {
    --nav-height: 56px;
  }

  .nav-inner {
    position: relative;
    min-height: var(--nav-height);
    padding: 0 14px;
    gap: 10px;
    flex-wrap: wrap;
  }

  .nav-logo {
    font-size: 19px;
    order: 1;
  }

  .mobile-menu-toggle {
    display: inline-flex;
    order: 2;
  }

  .nav-links {
    order: 4;
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 10px 0 14px;
    border-top: 1px solid var(--border);
  }

  .nav.mobile-open .nav-links {
    display: flex;
  }

  .nav-links li {
    width: 100%;
  }

  .nav-links a {
    display: block;
    padding: 11px 12px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    color: var(--text);
  }

  .nav-links a.active,
  .nav-links a:hover {
    background: rgba(0, 0, 0, 0.04);
  }

  .nav-actions {
    order: 3;
    margin-left: auto;
    gap: 8px;
  }

  .search-form {
    padding: 6px 10px;
  }

  .search-form input {
    width: min(28vw, 110px);
    font-size: 13px;
  }

  .btn-sm {
    padding: 7px 12px;
  }

  .user-menu-trigger {
    padding: 4px;
  }

  .user-avatar {
    width: 30px;
    height: 30px;
  }

  .user-menu-dropdown {
    right: 0;
    min-width: 148px;
  }

  .flash-messages {
    left: 14px;
    right: 14px;
  }

  .flash {
    width: 100%;
  }

  .section-header h2 {
    font-size: 32px;
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
  }

  .admin-nav {
    display: flex;
    overflow-x: auto;
    gap: 4px;
    padding: 0 16px;
  }

  .admin-nav a {
    white-space: nowrap;
    border-radius: 980px;
  }

  .admin-content {
    padding: 24px 16px;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }
}

/* User select for authorized users */
.user-select {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  background: var(--bg);
}

.user-select .form-check {
  padding: 4px 8px;
  border-radius: 8px;
}

.user-select .form-check:hover {
  background: rgba(0, 0, 0, 0.03);
}

/* Notebook */
.notebook-book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.notebook-book-card {
  display: block;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  transition: all var(--transition);
  color: inherit;
  text-decoration: none;
}

.notebook-book-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  color: inherit;
}

.notebook-book-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.notebook-book-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.notebook-book-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notebook-list {
  display: grid;
  gap: 16px;
}

.notebook-item {
  display: block;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 24px;
  transition: all var(--transition);
  color: inherit;
  text-decoration: none;
}

.notebook-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  color: inherit;
}

.notebook-item-title {
  font-size: 19px;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.notebook-item-preview {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-wrap;
}

.notebook-item-meta {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-tertiary);
}

.notebook-editor {
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 14px;
  line-height: 1.6;
}

.notebook-detail-header {
  max-width: 720px;
  margin: 0 auto 40px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
}

.notebook-detail-header h1 {
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-top: 12px;
}

.notebook-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.move-note-form {
  display: flex;
  gap: 6px;
  align-items: center;
}

.move-note-select {
  width: auto;
  min-width: 120px;
  padding: 6px 10px;
  font-size: 13px;
}

/* Markdown rendered content */
.markdown-body {
  max-width: 680px;
  margin: 0 auto;
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 1.6em 0 0.6em;
  line-height: 1.3;
}

.markdown-body h1 { font-size: 28px; }
.markdown-body h2 { font-size: 24px; }
.markdown-body h3 { font-size: 20px; }

.markdown-body p {
  margin-bottom: 1.2em;
}

.markdown-body ul,
.markdown-body ol {
  margin: 0 0 1.2em 1.4em;
}

.markdown-body li {
  margin-bottom: 0.4em;
}

.markdown-body code {
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 0.9em;
  background: rgba(0, 0, 0, 0.05);
  padding: 2px 6px;
  border-radius: 6px;
}

.markdown-body pre {
  background: #1d1d1f;
  color: #f5f5f7;
  padding: 20px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 1.2em 0;
  font-size: 14px;
  line-height: 1.5;
}

.markdown-body pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.markdown-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 16px;
  color: var(--text-secondary);
  margin: 1.2em 0;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2em 0;
  font-size: 15px;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid var(--border);
  padding: 10px 14px;
  text-align: left;
}

.markdown-body th {
  background: rgba(0, 0, 0, 0.03);
  font-weight: 500;
}

.markdown-body a {
  color: var(--accent);
}

.markdown-body img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin: 1em 0;
}

.markdown-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2em 0;
}

/* Fullscreen notebook editor */
.editor-fullscreen {
  overflow: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.editor-form {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.editor-toolbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  background: rgba(251, 251, 253, 0.95);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

.editor-toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.editor-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.editor-title-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-family: var(--font);
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  outline: none;
  letter-spacing: -0.02em;
}

.editor-title-input::placeholder {
  color: var(--text-tertiary);
}

.editor-layout {
  flex: 1;
  display: grid;
  min-height: 0;
  overflow: hidden;
}

.editor-layout.split-mode {
  grid-template-columns: 1fr 1fr;
}

.editor-layout.edit-only {
  grid-template-columns: 1fr;
}

.editor-layout.edit-only .preview-pane {
  display: none;
}

.editor-layout.preview-only {
  grid-template-columns: 1fr;
}

.editor-layout.preview-only .editor-pane {
  display: none;
}

.editor-pane,
.preview-pane {
  min-height: 0;
  overflow: auto;
}

.editor-pane {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.editor-pane .CodeMirror {
  flex: 1;
  height: 100% !important;
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 14px;
  line-height: 1.6;
  background: var(--bg-elevated);
}

.editor-pane .CodeMirror-gutters {
  background: rgba(0, 0, 0, 0.02);
  border-right: 1px solid var(--border);
}

.editor-pane .CodeMirror-scroll {
  min-height: 100%;
}

.CodeMirror-hints {
  font-family: var(--font);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
}

.CodeMirror-hint {
  padding: 6px 12px !important;
}

li.CodeMirror-hint-active {
  background: var(--accent) !important;
  color: #fff !important;
}

.editor-textarea {
  display: none;
}

/* 账号设置 */
.settings-section {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

.settings-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
  letter-spacing: -0.02em;
}

.editor-preview {
  max-width: none;
  padding: 24px 32px;
  min-height: 100%;
}

.preview-placeholder {
  color: var(--text-tertiary);
  font-size: 15px;
}

.editor-tab-btn.active {
  background: var(--accent);
  color: #fff;
}

.editor-split-btn {
  display: none;
}

@media (min-width: 769px) {
  .editor-split-btn {
    display: inline-flex;
  }

  .editor-tab-btn {
    display: none;
  }
}

@media (max-width: 768px) {
  .editor-layout.split-mode {
    grid-template-columns: 1fr;
  }

  .editor-layout.split-mode .preview-pane {
    display: none;
  }

  .editor-toolbar {
    flex-wrap: wrap;
    padding: 10px 14px;
  }

  .editor-title-input {
    font-size: 15px;
  }
}
