/* ===== Base Theme ===== */
:root {
  --bg: #fbfbfd;
  --surface: #ffffff;
  --surface-alt: #f4f6fb;
  --text: #161b2c;
  --muted: #7b8194;
  --accent: #ff6b5b;
  --accent-soft: #ffe1da;
  --line: #e1e4ed;
  font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", serif;
}
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

/* ===== Layout Structure ===== */
.app-shell {
  max-width: 1400px;
  padding: 16px 40px 60px;
  margin: 0 auto;
}

/* Header */
.top-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding: 12px 0 18px;
  border-bottom: 1px solid var(--line);
}

.top-bar > .brand {
  flex: 1;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  flex: 0 0 auto;
}

.logo-icon {
  width: 108px;
  height: 28px;
}

.logo-bar {
  fill: #ff6b5b;
}

.logo-pill {
  fill: #ffd166;
}

.logo-line {
  stroke: #111;
}

.wordmark {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.name {
  font-size: 20px;
  letter-spacing: 0.08em;
  font-weight: 700;
  background: linear-gradient(120deg, #111827, #4b5563);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.tagline {
  color: var(--muted);
  font-size: 13px;
}

/* Header Search */
.search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(22, 27, 44, 0.03);
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid rgba(22, 27, 44, 0.06);
  flex: 0 1 520px;
  max-width: 520px;
  margin: 0;
}

.search input {
  border: none;
  background: transparent;
  width: 100%;
  font-size: 15px;
  outline: none;
}

.search .icon {
  width: 20px;
  height: 20px;
  color: #ff6b5b;
}

.search .shortcut {
  color: var(--muted);
  font-size: 13px;
}

/* Header actions */
.user-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex: 1;
  justify-content: flex-end;
}

.mobile-menu-btn {
  display: none;
  border: 1px solid #e2e5f0;
  background: #fff;
  border-radius: 14px;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.user-actions button {
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  min-height: 42px;
}

@media (max-width: 900px) {
  .top-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .top-bar > .brand,
  .user-actions,
  .search {
    flex: none;
    width: 100%;
  }

  .search {
    margin: 0 auto;
  }

  .user-actions {
    justify-content: flex-start;
  }

  .user-actions button {
    width: 100%;
    justify-content: center;
  }
}

.ghost {
  background: rgba(22, 27, 44, 0.03);
  color: var(--text);
  border: 1px solid rgba(22, 27, 44, 0.06);
}

.solid {
  background: linear-gradient(120deg, #ff8a7a, #ff5d5d);
  color: #fff;
  box-shadow: none;
}

.avatar-menu {
  position: relative;
}

.avatar-menu summary {
  list-style: none;
  cursor: pointer;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.avatar-menu summary img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(22, 27, 44, 0.08);
}

.avatar-menu summary::-webkit-details-marker {
  display: none;
}

.avatar-menu[open] .menu-card {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.ai-companion {
  border: 1px solid rgba(22, 27, 44, 0.2);
  background: #fffef0;
  color: #111;
  border-radius: 24px;
  padding: 10px 18px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.ai-companion .menu-icon {
  width: 18px;
  height: 18px;
}

/* Grid shell */
.layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 300px;
  gap: 20px;
  margin-top: 8px;
  position: relative;
}

.layout::before {
  content: "";
  position: absolute;
  top: 36px;
  bottom: 0;
  left: 220px;
  width: 1px;
  background: #e3e7f2;
}

@media (max-width: 1200px) {
  .layout {
    grid-template-columns: 220px minmax(0, 1fr);
  }
  .layout::before {
    right: auto;
  }
  .right-rail {
    display: none;
  }
}

.sidebar-toggle {
  border: none;
  background: #fff;
  font-size: 20px;
  color: #6c7083;
  cursor: pointer;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid #dfe3f0;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 15px rgba(15, 23, 42, 0.08);
  position: absolute;
  left: 220px;
  top: 18px;
  transform: translateX(-50%);
  z-index: 3;
}

.sidebar {
  position: sticky;
  top: 24px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-right: 14px;
}

.sidebar-collapsed .sidebar {
  display: none;
}

.sidebar-collapsed .layout {
  grid-template-columns: minmax(0, 1fr) 300px;
}

.sidebar-collapsed .layout::before {
  left: 0;
}

.sidebar-collapsed .sidebar-toggle {
  left: 0;
  transform: translate(-50%, 0);
}

.feed::before {
  content: "";
  display: block;
  height: 16px;
}

.menu-trigger {
  border: none;
  background: transparent;
  border-radius: 12px;
  padding: 8px;
  font-size: 20px;
  color: var(--muted);
  cursor: pointer;
}

/* Sidebar menus & links */
.menu {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.menu:last-of-type {
  border-bottom: none;
}

.section-label {
  margin: 0 0 12px;
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  color: #2f3350;
  text-decoration: none;
  font-weight: 500;
  margin-bottom: 2px;
}

.menu-item.active {
  color: var(--accent);
}

.menu-icon {
  width: 18px;
  height: 18px;
  color: currentColor;
  flex-shrink: 0;
}
/* Sidebar micro cards */
.mini-card {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(22, 27, 44, 0.07);
  margin-top: 8px;
  align-items: center;
}

.mini-card .simple-icon {
  width: 28px;
  height: 28px;
  color: #2f3350;
}

.mini-card header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mini-card:last-child {
  border-bottom: none;
}

.mini-card.outline {
  background: transparent;
  border: none;
}

.mini-card .mini-btn {
  margin-left: auto;
}

.mini-card h4 {
  margin: 0 0 4px;
  font-size: 15px;
}

.mini-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.mini-card .mini-info {
  flex: 1;
}

.mini-card .mini-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.mini-card .mini-title .mini-btn {
  margin-left: auto;
}

.mini-btn {
  border: 1px solid rgba(22, 27, 44, 0.2);
  border-radius: 14px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  background: #fff;
  color: #1d2137;
  cursor: pointer;
}

.mini-btn.ghost {
  background: #edf0fb;
  border-color: transparent;
}

.mini-btn.success {
  background: #e9f9ef;
  border-color: transparent;
  color: #207741;
}

.mini-btn.invite {
  background: rgba(255, 107, 91, 0.16);
  color: #c24932;
  border-color: transparent;
  box-shadow: none;
}

/* ===== Feed ===== */
.feed {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 0 30px;
}

.feed-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 28px;
  border-bottom: 1px solid #e2e5f0;
}

/* Feed filter chips */
.chip-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--muted);
}

.chip {
  border: none;
  background: transparent;
  font-weight: 600;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
}

.chip span {
  font-size: 13px;
  letter-spacing: 0.1em;
}


.chip-divider {
  color: var(--text);
  font-size: 14px;
  opacity: 0.5;
  margin: 0 1px;
}

.chip-icon {
  width: 16px;
  height: 16px;
}

.chip.active {
  color: var(--text);
}



.post-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px 28px;
  background: transparent;
  position: relative;
  border-radius: 20px;
}

.post-card:not(:first-of-type)::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: #e2e5f0;
}

.post-card::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 18px;
  background: rgba(232, 236, 245, 0.8);
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 0;
}

.post-card:hover::after {
  opacity: 1;
}

.post-card > * {
  position: relative;
  z-index: 1;
}

.post-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: flex-start;
}

  .post-tools {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
  }

.post-menu {
  position: relative;
}

.post-menu summary {
  list-style: none;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  color: #6b7280;
}

.post-menu summary::-webkit-details-marker {
  display: none;
}

.post-menu[open] .menu-card {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.menu-card {
  position: absolute;
  right: 0;
  top: 28px;
  background: #fff;
  border: 1px solid #e5e7ef;
  border-radius: 12px;
  padding: 8px 0;
  width: 150px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.15);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none;
  z-index: 5;
}

.menu-card button {
  width: 100%;
  padding: 8px 16px;
  background: transparent;
  border: none;
  text-align: left;
  font-weight: 500;
  color: #1f2538;
  cursor: pointer;
}

.menu-card button:hover {
  background: rgba(15, 23, 42, 0.05);
}

.post-card h2 {
  margin: 4px 0 0;
  font-size: 21px;
  letter-spacing: 0.01em;
}

.post-card .meta {
  margin: 0;
  font-size: 13px;
  color: #8d93a6;
}

.post-card .excerpt {
  margin: 0;
  color: #1f2538;
  font-size: 15px;
  line-height: 1.6;
}

.post-preview {
  width: 100%;
  border-radius: 18px;
  border: 1px solid rgba(22, 27, 44, 0.08);
  overflow: hidden;
  background: #0a0f24;
  margin: 0;
}

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

.post-preview video {
  max-height: 520px;
}

.post-preview.gradient-a {
  background: linear-gradient(135deg, #f4f2ff, #dfe7ff);
}

.post-preview.gradient-b {
  background: linear-gradient(135deg, #fef4e6, #ffe4ec);
}

.post-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.action-btn {
  border: none;
  border-radius: 999px;
  padding: 8px 16px;
  background: #f2f4f7;
  color: #0f172a;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.action-btn svg {
  width: 18px;
  height: 18px;
}
.right-rail {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel {
  padding: 18px 20px 20px;
  border-radius: 22px;
  background: #f8faff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  color: #202333;
}

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

.panel-header button {
  border: none;
  background: transparent;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
}

.panel h3 {
  margin: 0;
}

.panel .meta {
  margin: 0 0 2px;
  font-size: 11px;
  color: #676c83;
}

.list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
}

.list li {
  padding: 8px 0;
  border-bottom: 1px solid rgba(22, 27, 44, 0.09);
}

.list li > *:not(:last-child) {
  margin-bottom: 2px;
}

.list.tight {
  gap: 0;
}

.list.tight li {
  padding: 10px 0;
}

.list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.list li:first-child {
  padding-top: 0;
}

.list h4 {
  margin: 0;
}

.list .stat,
.panel .stat {
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
}

.stack-card {
  padding: 8px 0;
  margin: 0;
  line-height: 1.3;
}

.stack-card + .stack-card {
  border-top: 1px solid rgba(22, 27, 44, 0.07);
  margin-top: 6px;
}

.stack-card h4 {
  margin: 2px 0 4px;
}

.stack-card p {
  font-size: 14px;
}

.footer {
  margin-top: 40px;
  text-align: center;
  color: #9197ac;
  font-size: 13px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.gallery {
  display: flex;
  gap: 8px;
  align-items: stretch;
  height: 360px;
}

.gallery-main {
  flex: 2;
}

.gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 24px;
}

.gallery-side {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gallery-side img {
  width: 100%;
  flex: 1;
  object-fit: cover;
  display: block;
  border-radius: 24px;
}
.join {
  background: #1e2237;
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  border: none;
  font-weight: 600;
  cursor: pointer;
}

.join.subtle {
  background: var(--surface-alt);
  color: var(--muted);
}

.join.tiny {
  padding: 6px 12px;
  font-size: 12px;
}

/* ===== Mobile Extras ===== */
.mobile-dock {
  display: none;
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: 16px;
  padding: 8px 10px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #e5e7ef;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(14px);
  z-index: 40;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.dock-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border: 1px solid transparent;
  background: transparent;
  color: #9aa0b5;
  border-radius: 12px;
  padding: 10px 8px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
  position: relative;
}

.dock-btn svg {
  width: 20px;
  height: 20px;
}

.dock-btn span {
  font-size: 12px;
  letter-spacing: 0.02em;
}

.dock-btn.active {
  background: radial-gradient(circle at 50% 28%, rgba(255, 107, 91, 0.18), rgba(255, 107, 91, 0) 60%), #fff;
  border-color: transparent;
  color: var(--accent);
  box-shadow: 0 10px 22px rgba(255, 107, 91, 0.25);
  transform: translateY(-2px);
}

.dock-btn.active svg {
  filter: drop-shadow(0 6px 10px rgba(255, 107, 91, 0.35));
}

.mobile-fab {
  display: none;
  position: fixed;
  right: 18px;
  bottom: 86px;
  padding: 13px 18px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #ff8a7a, #ff5d5d);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 18px 36px rgba(255, 93, 93, 0.35);
  z-index: 45;
  cursor: pointer;
}

/* ===== Mobile Layout ===== */
@media (max-width: 768px) {
  .app-shell {
    padding: 12px 16px 130px;
  }

  .top-bar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: 10px 0 12px;
    column-gap: 8px;
    row-gap: 10px;
    display: grid;
    grid-template-columns: 46px 1fr auto;
    grid-template-areas:
      "brand brand actions"
      "menu search search";
    align-items: center;
  }

  .logo-icon {
    width: 92px;
    height: 24px;
  }

  .name {
    font-size: 18px;
  }

  .tagline {
    font-size: 12px;
  }

  .search {
    grid-area: search;
    width: 100%;
    flex: none;
    padding: 10px 14px;
    background: #fff;
    border: 1px solid #e3e7f2;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
    min-width: 0;
  }

  .mobile-menu-btn {
    grid-area: menu;
    display: inline-flex;
    width: 46px;
    height: 46px;
    margin-right: 0;
    justify-content: center;
  }

  .brand {
    grid-area: brand;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
  }

  .user-actions {
    grid-area: actions;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: 0;
    justify-content: flex-end;
  }

  .user-actions .ghost,
  .user-actions .solid {
    display: none;
  }

  .user-actions .ai-companion {
    padding: 8px 14px;
    min-width: 0;
    max-width: 140px;
    white-space: nowrap;
  }

  .avatar-menu summary img {
    width: 32px;
    height: 32px;
  }

  .layout {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  .layout::before {
    display: none;
  }

  .sidebar,
  .sidebar-toggle {
    display: none;
  }

  .feed {
    padding: 0 0 10px;
    gap: 12px;
  }

  .feed-controls {
    padding: 10px 4px;
    position: sticky;
    top: 96px;
    z-index: 20;
    background: var(--bg);
    border-bottom: none;
  }

  .chip-group {
    gap: 12px;
  }

  .chip span {
    font-size: 14px;
    letter-spacing: 0.04em;
  }

  .post-card {
    padding: 18px 16px;
    border: 1px solid #e7e9f2;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.12);
  }

  .post-card:not(:first-of-type)::before,
  .post-card::after {
    display: none;
  }

  .post-head {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
  }

  .post-card h2 {
    font-size: 18px;
    line-height: 1.3;
  }

  .post-card .excerpt {
    font-size: 14px;
  }

  .post-preview {
    border-radius: 16px;
  }

  .post-preview video {
    max-height: 320px;
  }

  .gallery {
    flex-direction: column;
    height: auto;
  }

  .gallery-side {
    flex-direction: row;
  }

  .gallery-side img {
    height: 120px;
  }

  .post-actions {
    gap: 8px;
  }

  .action-btn {
    padding: 8px 12px;
    font-size: 13px;
  }

  .right-rail {
    display: flex;
    flex-direction: column;
    order: 3;
    gap: 12px;
  }

  .panel {
    background: #fff;
    border: 1px solid #e7e9f2;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
    border-radius: 18px;
  }

  .footer {
    padding-bottom: 70px;
    margin-top: 28px;
  }

  .mobile-dock {
    display: grid;
  }

  .mobile-fab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }

  .mobile-drawer {
    display: block;
  }
}

.mobile-drawer {
  display: none;
}

.mobile-drawer .drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 18, 32, 0.4);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  z-index: 60;
}

.mobile-drawer .drawer-panel {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 80%;
  max-width: 360px;
  background: #fff;
  box-shadow: 12px 0 40px rgba(15, 23, 42, 0.15);
  transform: translateX(-100%);
  transition: transform 0.22s ease;
  z-index: 70;
  display: flex;
  flex-direction: column;
  padding: 16px 14px 24px;
  overflow: hidden;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0 10px;
}

.drawer-head .brand.mini .logo-icon {
  width: 86px;
  height: 22px;
}

.drawer-head .wordmark .name {
  font-size: 16px;
}

.drawer-head .wordmark .tagline {
  font-size: 12px;
}

.drawer-close {
  border: 1px solid #e2e5f0;
  background: #fff;
  border-radius: 12px;
  width: 34px;
  height: 34px;
  cursor: pointer;
}

.drawer-actions {
  display: flex;
  gap: 8px;
  padding: 8px 0 12px;
  align-items: center;
}

.drawer-actions .ghost {
  flex: 1;
  justify-content: center;
  padding: 10px 18px;
  background: rgba(22, 27, 44, 0.03);
  border: 1px solid rgba(22, 27, 44, 0.06);
}

.drawer-menu {
  flex: 1;
  overflow: auto;
  padding: 4px 2px 0;
}

.drawer-menu .menu {
  padding: 10px 0 14px;
  border-bottom: 1px solid #eceff5;
}

.drawer-menu .menu:last-of-type {
  border-bottom: none;
}

.drawer-menu .menu:first-of-type .section-label {
  display: none;
}

.drawer-menu .menu:nth-of-type(2) {
  background: #f8faff;
  border: 1px solid #e7eaf4;
  border-radius: 14px;
  padding: 12px 12px 10px;
  margin: 8px 0 12px;
}

.drawer-menu .mini-card {
  padding: 10px 0 12px;
  margin: 0;
  border-bottom: 1px solid rgba(22, 27, 44, 0.05);
}

.drawer-menu .mini-card:last-child {
  border-bottom: none;
}

.drawer-menu .mini-card .mini-title {
  margin-bottom: 6px;
}

.mobile-open .mobile-drawer {
  display: block;
}

.mobile-open .mobile-drawer .drawer-overlay {
  opacity: 1;
  pointer-events: auto;
}

.mobile-open .mobile-drawer .drawer-panel {
  transform: translateX(0);
}

.mobile-open {
  overflow: hidden;
}
