:root {
  --bg: #f3f6f8;
  --bg-soft: #eef7f7;
  --surface: #ffffff;
  --surface-muted: #f7fafc;
  --text: #10232f;
  --text-secondary: #345163;
  --text-muted: #6b7d89;
  --accent: #0f766e;
  --accent-strong: #0c5d57;
  --accent-soft: #ddf4f1;
  --border: #d9e4ea;
  --border-strong: #c2d2dc;
  --shadow: 0 8px 22px rgba(15, 23, 42, 0.07);
  --shadow-soft: 0 4px 14px rgba(15, 23, 42, 0.05);
  --radius: 4px;
  --max-width: 1760px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  max-width: 100%;
  overflow-x: clip;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.08), transparent 18%, transparent 82%, rgba(59, 130, 246, 0.06)),
    linear-gradient(180deg, #f7fbff 0%, var(--bg) 220px);
  color: var(--text);
  font: 14px/1.62 "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  max-width: 100%;
  overflow-x: clip;
}

a {
  color: #0f4c81;
  text-decoration: none;
  transition: color 0.18s ease;
}

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

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

.container {
  width: min(100% - 48px, var(--max-width));
  margin: 0 auto;
}

.navbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(180deg, rgba(8, 22, 31, 0.96) 0%, rgba(11, 33, 43, 0.94) 100%);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 6px 18px rgba(3, 7, 18, 0.24);
}

.navbar-inner {
  display: grid;
  grid-template-columns: auto minmax(280px, 440px) minmax(0, 1fr);
  grid-template-areas: "brand search nav";
  align-items: center;
  gap: 18px;
  min-height: 60px;
  padding: 4px 0;
}

.brand {
  grid-area: brand;
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.brand img {
  width: 190px;
  max-width: 100%;
  height: auto;
}

.navbar-search {
  grid-area: search;
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: none;
}

.search-query {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  font: inherit;
  box-shadow: inset 0 1px 2px rgba(3, 7, 18, 0.2);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.search-query::placeholder {
  color: rgba(226, 232, 240, 0.58);
}

.search-query:focus {
  outline: none;
  border-color: rgba(94, 234, 212, 0.46);
  box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.14);
  background: rgba(255, 255, 255, 0.12);
}

.navbar-search-submit {
  flex: 0 0 auto;
  height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(94, 234, 212, 0.42);
  border-radius: 3px;
  background: rgba(20, 184, 166, 0.2);
  color: #f8fafc;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.navbar-search-submit:hover {
  border-color: rgba(94, 234, 212, 0.72);
  background: rgba(20, 184, 166, 0.34);
  color: #ffffff;
}

.nav-links {
  grid-area: nav;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 14px;
  min-width: 0;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  color: rgba(226, 232, 240, 0.84);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.nav-links a:hover {
  color: #ffffff;
}

#main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  align-items: start;
  gap: 18px;
  padding: 18px 0 42px;
}

#content,
#sidebar {
  min-width: 0;
}

#content {
  grid-column: 1;
  grid-row: 1;
}

#sidebar {
  grid-column: 2;
  grid-row: 1;
}

.wide-content {
  grid-column: 1 / -1;
}

.panel {
  overflow: hidden;
  margin-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.panel-header,
.breadcrumb-row,
.topic-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fbfdff 0%, var(--surface-muted) 100%);
  font-weight: 700;
}

.panel-header {
  justify-content: space-between;
}

.panel-header span {
  min-width: 0;
}

.panel-header span,
.panel-intro p,
.topic-title,
.topic-excerpt,
.compact-topic-list a {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.panel-header a {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.breadcrumb-row {
  color: var(--text-secondary);
  font-size: 13px;
}

.topic-tabs {
  gap: 6px 14px;
}

.panel-body,
.panel-intro,
.topic-page-header,
.topic_content {
  padding: 14px;
}

.reply-list {
  padding: 0;
}

.panel-body.no-padding {
  padding: 0;
}

.panel-intro {
  display: grid;
  gap: 8px;
  background: linear-gradient(180deg, #f6fffd 0%, #ffffff 100%);
}

.panel-intro p,
.footer-inner p {
  margin: 0;
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
}

.hero-card,
.promo-link,
.friend-link-list a {
  display: block;
  overflow: hidden;
  border-radius: var(--radius);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.hero-card:hover,
.promo-link:hover,
.friend-link-list a:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.1);
}

.friend-link-list a {
  overflow: visible;
}

.hero-card {
  border-radius: 0;
}

.hero-card img {
  width: 100%;
  aspect-ratio: 5 / 3;
  object-fit: cover;
  border-radius: 0;
  border: 0;
  background: transparent;
  transition: transform 0.24s ease;
}

.hero-card:hover img {
  transform: scale(1.03);
}

.topic-tab {
  display: inline-flex;
  align-items: center;
  padding: 5px 8px;
  border: 0;
  border-radius: 3px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
}

.topic-tab:hover {
  color: var(--accent-strong);
}

.current-tab {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.topic-cell,
.reply-cell {
  display: grid;
  align-items: start;
  gap: 16px;
  border-bottom: 1px solid var(--border);
}

.topic-cell {
  grid-template-columns: 36px minmax(0, 1fr) 92px;
  gap: 10px;
  padding: 10px 12px;
}

.reply-cell {
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 14px;
}

.topic-cell:last-child,
.reply-cell:last-child {
  border-bottom: 0;
}

.user_avatar {
  display: inline-flex;
}

.user_avatar img,
.reply-cell .user_avatar img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(15, 23, 42, 0.08);
  object-fit: cover;
  background: #ffffff;
}

.topic-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.topic-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 7px;
}

.topic-title {
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.38;
}

.topic-excerpt {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.topic-meta,
.reply-meta,
.topic-last-reply,
.topic-page-meta,
.user-profile-meta,
.user-profile-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--text-muted);
  font-size: 12px;
}

.topic-last-reply {
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  text-align: right;
  font-weight: 600;
}

.topic-last-reply img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(15, 23, 42, 0.08);
  object-fit: cover;
}

.topic-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 800;
}

.badge-top {
  background: #fee2e2;
  color: #b91c1c;
}

.badge-good {
  background: #fef3c7;
  color: #b45309;
}

.badge-tab {
  background: #dbeafe;
  color: #1d4ed8;
}

.pagination {
  padding: 12px 14px 14px;
}

.pagination ul {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pagination li a,
.pagination li span {
  display: inline-flex;
  justify-content: center;
  min-width: 30px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface);
  font-weight: 600;
}

.pagination .active span,
.pagination li a:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.pagination .disabled span {
  opacity: 0.45;
}

.promo-list,
.friend-link-list {
  display: grid;
  gap: 8px;
}

.promo-image,
.friend-image,
.qrcode-image {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #ffffff;
}

.friend-image {
  height: auto;
  object-fit: contain;
}

.qrcode-image {
  max-width: 240px;
  margin: 0 auto;
}

.compact-topic-list,
.ranking-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 16px;
}

.compact-topic-list li,
.ranking-list li {
  line-height: 1.5;
  font-size: 13px;
}

.ranking-list li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.author-card {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.author-avatar,
.user-profile-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(15, 23, 42, 0.08);
  object-fit: cover;
}

.author-card-main,
.user-profile-main,
.reply-body {
  min-width: 0;
}

.author-card-name {
  display: inline-block;
  margin-bottom: 4px;
  color: var(--accent-strong);
  font-size: 17px;
  font-weight: 700;
}

.author-card-main p {
  margin: 0;
  line-height: 1.55;
  font-size: 13px;
}

.topic-page-header {
  display: grid;
  gap: 10px;
}

.topic-page-title {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
}

.topic-page-title h1 {
  margin: 0;
  color: var(--text);
  font-size: 26px;
  line-height: 1.35;
}

.topic_content,
.reply-content {
  font-size: 15px;
  line-height: 1.78;
}

.reply-meta {
  margin-bottom: 10px;
}

.reply-author {
  color: var(--text);
  font-weight: 700;
}

.markdown-text {
  color: var(--text);
}

.markdown-text > :first-child {
  margin-top: 0;
}

.markdown-text > :last-child {
  margin-bottom: 0;
}

.markdown-text h1,
.markdown-text h2,
.markdown-text h3,
.markdown-text h4,
.markdown-text h5 {
  margin: 1.5em 0 0.7em;
  color: var(--text);
  line-height: 1.35;
}

.markdown-text p,
.markdown-text ul,
.markdown-text ol,
.markdown-text blockquote,
.markdown-text table,
.markdown-text pre {
  margin: 0 0 1.15em;
}

.markdown-text ul,
.markdown-text ol {
  padding-left: 1.5em;
}

.markdown-text li {
  margin: 0.35em 0;
}

.markdown-text a {
  color: var(--accent-strong);
  text-decoration: underline;
  text-decoration-color: rgba(15, 118, 110, 0.3);
  text-underline-offset: 3px;
}

.markdown-text img {
  margin: 18px auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}

.markdown-text blockquote {
  padding: 14px 16px;
  border-left: 4px solid #34d399;
  border-radius: 0 var(--radius) var(--radius) 0;
  background: #f3fbf8;
  color: #4b5563;
}

.markdown-text table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  white-space: nowrap;
}

.markdown-text th,
.markdown-text td {
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: #ffffff;
  text-align: left;
}

.markdown-text th {
  background: var(--surface-muted);
}

.markdown-text pre {
  overflow: auto;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: #0f172a;
  color: #e2e8f0;
}

.markdown-text code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.92em;
}

.markdown-text :not(pre) > code {
  padding: 2px 6px;
  border-radius: 6px;
  background: #eef4f7;
  color: #0f172a;
}

.markdown-text pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.user-profile {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.user-profile-avatar {
  width: 76px;
  height: 76px;
}

.user-profile-main {
  display: grid;
  gap: 6px;
}

.user-profile-name {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
}

.signature {
  margin: 0;
  color: var(--text-muted);
}

.more-link {
  padding: 0 14px 14px;
}

.more-link a {
  font-weight: 700;
}

.ranking-table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}

.ranking-table th,
.ranking-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

.ranking-table th {
  color: var(--text-secondary);
  font-size: 13px;
}

.search-page-form {
  display: flex;
  gap: 8px;
  width: min(100%, 680px);
}

.search-page-query {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
}

.search-page-query:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.search-page-submit {
  flex: 0 0 auto;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--accent-strong);
  border-radius: 3px;
  background: var(--accent);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.search-page-submit:hover {
  background: var(--accent-strong);
}

.apps-page {
  display: grid;
  gap: 24px;
}

.app-group {
  display: grid;
  gap: 14px;
}

.app-group h2 {
  margin: 0;
  font-size: 20px;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.app-item {
  display: grid;
  gap: 10px;
  justify-items: center;
  margin: 0;
  text-align: center;
}

.app-item img {
  width: 120px;
  height: 120px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.app-item figcaption {
  color: var(--text-secondary);
  font-size: 14px;
}

.empty-state {
  padding: 32px 14px;
  color: var(--text-muted);
  text-align: center;
}

#footer {
  padding: 0 0 38px;
}

.footer-inner {
  display: grid;
  gap: 8px;
  padding: 14px 0;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
}

.sponsor-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  color: var(--text-muted);
}

.sponsor-row a {
  display: inline-flex;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  line-height: 0;
}

.sponsor-row img {
  width: auto;
  height: 18px;
}

@media (max-width: 1180px) {
  .container {
    width: min(100% - 28px, var(--max-width));
  }

  #main {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  #content,
  #sidebar,
  .wide-content {
    width: 100%;
    max-width: 100%;
  }

  #content {
    order: 1;
  }

  #sidebar {
    order: 2;
  }

  .navbar-inner {
    grid-template-columns: auto minmax(220px, 1fr);
    grid-template-areas:
      "brand search"
      "nav nav";
    gap: 14px 18px;
  }

  .navbar-search {
    max-width: 520px;
  }

  .nav-links {
    justify-content: flex-start;
  }

  .hero-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 981px) and (max-width: 1180px) {
  .panel-body,
  .panel-intro,
  .topic-page-header,
  .topic_content {
    padding: 12px;
  }

  .topic-cell {
    grid-template-columns: 34px minmax(0, 1fr) 86px;
    gap: 10px;
    padding: 10px 12px;
  }

  .user_avatar img,
  .reply-cell .user_avatar img {
    width: 34px;
    height: 34px;
  }

  .topic-title {
    font-size: 14px;
  }
}

@media (max-width: 980px) {
  #main {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  #content,
  #sidebar,
  .wide-content {
    width: 100%;
  }

  #content {
    order: 1;
  }

  #sidebar {
    order: 2;
  }

  .topic-cell {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .topic-last-reply {
    grid-column: 2;
    justify-content: flex-start;
    text-align: left;
  }

  .topic-page-title h1 {
    font-size: 23px;
  }

  .user-profile {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .user-profile-avatar {
    width: 64px;
    height: 64px;
  }
}

@media (max-width: 720px) {
  body {
    font-size: 13px;
  }

  .container {
    width: min(100% - 20px, var(--max-width));
  }

  .navbar-inner {
    grid-template-columns: 1fr;
    grid-template-areas:
      "brand"
      "search"
      "nav";
    gap: 10px;
    padding: 10px 0 12px;
  }

  .brand img {
    width: min(100%, 190px);
  }

  .navbar-search {
    max-width: none;
  }

  .search-query {
    height: 36px;
    padding: 0 12px;
    font-size: 13px;
  }

  .navbar-search-submit {
    height: 36px;
    padding: 0 12px;
    font-size: 13px;
  }

  .nav-links {
    flex-wrap: nowrap;
    gap: 8px;
    margin: 0 -2px;
    padding-bottom: 2px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .nav-links::-webkit-scrollbar {
    display: none;
  }

  .nav-links a {
    flex: 0 0 auto;
    min-height: 32px;
    padding: 6px 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(241, 245, 249, 0.92);
  }

  .panel-header,
  .breadcrumb-row,
  .topic-tabs {
    padding: 10px 12px;
  }

  .panel-body,
  .panel-intro,
  .topic-page-header,
  .topic_content {
    padding: 12px;
  }

  .hero-grid {
    gap: 8px;
    padding: 10px;
  }

  .topic-cell,
  .reply-cell {
    gap: 10px;
    padding: 10px 12px;
  }

  .topic-cell,
  .reply-cell {
    grid-template-columns: 32px minmax(0, 1fr);
  }

  .user_avatar img,
  .reply-cell .user_avatar img {
    width: 32px;
    height: 32px;
  }

  .topic-title {
    font-size: 14px;
  }

  .topic-excerpt {
    font-size: 12px;
  }

  .topic-page-title h1 {
    font-size: 21px;
  }

  .author-card,
  .user-profile {
    grid-template-columns: 1fr;
  }

  .author-card-name {
    font-size: 17px;
  }

  .user-profile-name {
    font-size: 20px;
  }

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

  .app-item img {
    width: 100px;
    height: 100px;
  }

  .footer-inner {
    padding: 12px 0;
  }

}

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

  .topic-tabs {
    gap: 8px;
  }

  .topic-tab {
    padding: 5px 8px;
  }

  .topic-meta,
  .reply-meta,
  .topic-page-meta,
  .user-profile-meta,
  .user-profile-links {
    gap: 8px 12px;
  }

  .qrcode-image {
    max-width: 220px;
  }
}
