:root {
  --brand: #1677ff;
  --text: #222;
  --muted: #777;
  --light: #f6f6f6;
  --line: #eee;
  --card: #fff;
  --shadow: 0 18px 60px rgba(0, 0, 0, .16);
  --sidebar: 284px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: #fff;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 26px 28px 24px;
  border-right: 1px solid #f4f4f4;
  background: #fff;
  display: flex;
  flex-direction: column;
}

.brand {
  width: 92px;
  height: 42px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--brand);
  color: #fff;
  font-weight: 900;
  text-decoration: none;
  letter-spacing: .5px;
}

.side-nav {
  margin-top: 46px;
  display: grid;
  gap: 12px;
}

.side-item,
.plain-link {
  width: 100%;
  min-height: 54px;
  padding: 0 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: #191919;
  font-size: 18px;
  font-weight: 650;
  text-align: left;
}

.side-item:hover,
.side-item.active {
  background: var(--light);
}

.side-icon {
  width: 22px;
  text-align: center;
  font-size: 22px;
}

.side-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
}

/* .avatar-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #50d2c2, #ffd166 50%, #ef476f);
  display: inline-block;
} */

.sidebar-bottom {
  margin-top: auto;
  display: grid;
  gap: 8px;
}

.plain-link {
  min-height: 44px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 14px;
}

.plain-link:hover {
  background: var(--light);
}

.main-content {
  min-width: 0;
  padding: 22px 64px 60px 44px;
}

.topbar {
  height: 48px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 20px;
}

.search-wrap {
  width: min(600px, 100%);
  justify-self: center;
  position: relative;
}

.search-wrap input {
  width: 100%;
  height: 42px;
  padding: 0 48px 0 24px;
  border: 0;
  outline: 0;
  border-radius: 999px;
  background: #f5f5f5;
  color: #333;
}

.search-wrap input:focus {
  box-shadow: 0 0 0 2px rgba(22, 119, 255, .14);
}

.search-icon {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: #555;
  font-size: 24px;
}

.top-links {
  display: flex;
  align-items: center;
  gap: 32px;
  white-space: nowrap;
}

.text-link {
  color: #555;
  font-size: 16px;
}

.text-link:hover {
  color: var(--brand);
}

.page-section {
  margin-top: 28px;
}

.category-tabs {
  display: flex;
  align-items: center;
  gap: 34px;
  overflow-x: auto;
  padding-bottom: 16px;
}

.category-tab {
  padding: 10px 16px;
  border-radius: 999px;
  white-space: nowrap;
  color: #555;
  font-size: 16px;
}

.category-tab.active {
  color: #111;
  background: var(--light);
  font-weight: 800;
}

.stats-line {
  min-height: 22px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 14px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 28px 26px;
  align-items: start;
}

.note-card {
  overflow: hidden;
  background: #fff;
  border-radius: 18px;
  transition: transform .18s ease, box-shadow .18s ease;
}

.note-card:hover {
  transform: translateY(-3px);
}

.cover-wrap {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 18px;
  background: #f4f4f4;
  aspect-ratio: 3 / 4;
}

.cover-wrap img,
.cover-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-badge,
.multi-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, .28);
  color: #fff;
  font-size: 13px;
}

.card-title {
  margin: 10px 8px 8px;
  font-size: 15px;
  line-height: 1.45;
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  margin: 0 8px 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.author-mini {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.author-mini img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
}

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

.card-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 7px;
}

.card-actions span {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.placeholder-page {
  display: grid;
  min-height: calc(100vh - 120px);
  place-items: center;
}

.personal-page {
  min-height: calc(100vh - 120px);
  display: grid;
  align-items: center;
}

.personal-hero {
  width: min(1120px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(320px, .82fr);
  gap: 44px;
  align-items: center;
}

.personal-photo-wrap {
  margin: 0;
  border-radius: 24px;
  overflow: hidden;
  background: #f4f4f4;
  box-shadow: 0 22px 70px rgba(23, 36, 55, .14);
}

.personal-photo {
  width: 100%;
  aspect-ratio: 2360 / 1292;
  object-fit: cover;
  display: block;
}

.personal-intro {
  min-width: 0;
}

.personal-kicker {
  margin: 0 0 14px;
  color: var(--brand);
  font-size: 15px;
  font-weight: 800;
}

.personal-intro h1 {
  margin: 0;
  font-size: 54px;
  line-height: 1.02;
  font-weight: 900;
}

.personal-quote {
  margin: 26px 0 0;
  color: #202020;
  font-size: 28px;
  line-height: 1.45;
  font-weight: 800;
}

.personal-note {
  margin: 18px 0 0;
  color: #666;
  font-size: 16px;
  line-height: 1.8;
}

.personal-links {
  margin-top: 30px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.personal-links a {
  min-height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: #111;
  font-weight: 800;
  text-decoration: none;
}

.personal-links a + a {
  color: #1f4f8f;
  background: #eef6ff;
}

.placeholder-card {
  width: min(640px, 100%);
  padding: 44px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(135deg, #fff, #f1f7ff);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .06);
}

.placeholder-kicker {
  margin: 0 0 12px;
  color: var(--brand);
  font-weight: 800;
}

.placeholder-card h1 {
  margin: 0 0 12px;
  font-size: 34px;
}

.placeholder-card p:last-child {
  margin: 0;
  color: #555;
  line-height: 1.8;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 34px;
  background: rgba(0, 0, 0, .34);
}

.modal.show {
  display: flex;
}

.modal-close {
  position: fixed;
  top: 28px;
  left: 28px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .26);
  color: #fff;
  font-size: 34px;
  line-height: 38px;
}

.modal-card {
  width: min(1120px, 94vw);
  height: min(860px, 90vh);
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(360px, .9fr);
  border-radius: 20px;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow);
}

.modal-media {
  position: relative;
  background: #f2f2f2;
  display: grid;
  place-items: center;
  min-width: 0;
}

.modal-media img,
.modal-media video {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.modal-media video {
  background: #000;
}

.media-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .2);
  color: #fff;
  font-size: 34px;
  display: grid;
  place-items: center;
  z-index: 2;
}

.media-prev {
  left: 18px;
}

.media-next {
  right: 18px;
}

.media-counter {
  position: absolute;
  top: 16px;
  right: 18px;
  padding: 5px 10px;
  border-radius: 999px;
  color: #fff;
  background: rgba(0, 0, 0, .32);
  font-size: 13px;
  font-weight: 700;
}

.media-dots {
  position: absolute;
  bottom: 18px;
  display: flex;
  gap: 8px;
}

.media-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .65);
}

.media-dot.active {
  background: #fff;
}

.modal-info {
  display: flex;
  min-width: 0;
  flex-direction: column;
  border-left: 1px solid var(--line);
}

.author-row {
  min-height: 78px;
  padding: 18px 22px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.author-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
}

.author-name {
  font-weight: 800;
}

.meta-text {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.follow-btn {
  min-width: 86px;
  height: 38px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
}

.post-body {
  padding: 18px 22px 10px;
}

.post-body h2 {
  margin: 0 0 12px;
  font-size: 21px;
}

.post-body p {
  margin: 0;
  color: #333;
  line-height: 1.75;
  white-space: pre-line;
}

.tag-list {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  color: #24539b;
  font-size: 14px;
}

.comment-header {
  padding: 14px 22px 10px;
  border-top: 1px solid #f5f5f5;
  color: #666;
  font-size: 14px;
}

.comment-list {
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding: 0 22px 18px;
}

.comment-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  padding: 12px 0;
}

.comment-item.reply {
  margin-left: 44px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.comment-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
}

.comment-name {
  color: #777;
  font-size: 14px;
}

.comment-text {
  margin-top: 4px;
  line-height: 1.58;
}

.comment-meta {
  margin-top: 5px;
  color: #999;
  display: flex;
  gap: 14px;
  font-size: 13px;
}

.modal-actions {
  min-height: 70px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-top: 1px solid var(--line);
}

.action-btn {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: #f7f7f7;
  color: #333;
}

.action-btn.active {
  color: var(--brand);
  background: #eef6ff;
  font-weight: 800;
}

.empty-state {
  grid-column: 1 / -1;
  min-height: 240px;
  display: grid;
  place-items: center;
  color: #888;
  background: #fafafa;
  border-radius: 24px;
}

@media (max-width: 1100px) {
  :root {
    --sidebar: 96px;
  }

  .sidebar {
    padding-left: 16px;
    padding-right: 16px;
    align-items: center;
  }

  .brand {
    width: 56px;
    height: 34px;
    font-size: 12px;
  }

  .side-item,
  .plain-link {
    justify-content: center;
    padding: 0;
  }

  .side-item span:last-child,
  .plain-link {
    font-size: 0;
  }

  .plain-link::first-letter {
    font-size: 22px;
  }

  .main-content {
    padding: 18px 28px 44px;
  }
}

@media (max-width: 860px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 30;
    height: 68px;
    padding: 8px 12px;
    border-top: 1px solid var(--line);
    border-right: 0;
    flex-direction: row;
    justify-content: center;
  }

  .brand,
  .sidebar-bottom {
    display: none;
  }

  .side-nav {
    margin: 0;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
  }

  .side-item {
    min-height: 52px;
    border-radius: 16px;
    gap: 2px;
    flex-direction: column;
  }

  .side-item span:last-child {
    display: inline;
    font-size: 12px;
    font-weight: 650;
  }

  .main-content {
    padding: 12px 14px 96px;
  }

  .topbar {
    height: auto;
    grid-template-columns: 1fr;
  }

  .search-wrap {
    justify-self: stretch;
  }

  .top-links {
    display: none;
  }

  .category-tabs {
    gap: 14px;
  }

  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 12px;
  }

  .personal-page {
    min-height: auto;
    align-items: start;
  }

  .personal-hero {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .personal-photo-wrap {
    border-radius: 18px;
  }

  .personal-intro h1 {
    font-size: 38px;
  }

  .personal-quote {
    margin-top: 20px;
    font-size: 23px;
  }

  .modal {
    padding: 0;
    align-items: stretch;
  }

  .modal-close {
    top: 12px;
    left: 12px;
    z-index: 55;
  }

  .modal-card {
    width: 100%;
    height: 100%;
    border-radius: 0;
    grid-template-columns: 1fr;
    grid-template-rows: 45vh minmax(0, 1fr);
  }

  .modal-info {
    border-left: 0;
  }

  .comment-item.reply {
    margin-left: 22px;
  }
}
