:root {
  --brand: #16859b;
  --brand-deep: #0e6f83;
  --header-bg: #f2f8f6;
  --bar-bg: #eef6f4;
  --text: #222;
  --muted: #8b9297;
  --line: #e7ecea;
  --page: #fff;
  --link: #1680a0;
}

* { box-sizing: border-box; }
html { background: var(--page); }
body {
  margin: 0;
  color: var(--text);
  background: var(--page);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.75;
}

.site-header {
  height: 72px;
  background: var(--header-bg);
  border-bottom: 1px solid #edf2f0;
}

.site-header__inner {
  width: min(1120px, calc(100% - 48px));
  height: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
}

.brand {
  color: var(--brand);
  font-size: 31px;
  font-weight: 800;
  letter-spacing: -1px;
  text-decoration: none;
}

.forum-layout {
  width: min(1120px, calc(100% - 48px));
  margin: 38px auto 80px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px;
  gap: 24px;
  align-items: start;
}

.thread-shell { min-width: 0; }

.thread {
  max-width: 980px;
}

.thread__title {
  margin: 0 0 18px;
  font-size: 30px;
  line-height: 1.35;
  font-weight: 700;
  letter-spacing: .1px;
}

.topic {
  padding-bottom: 30px;
  border-bottom: 1px solid var(--line);
}

.topic__meta {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
}

.topic__identity { min-width: 0; }

.avatar {
  width: 50px;
  height: 50px;
  flex: 0 0 50px;
  object-fit: cover;
  border-radius: 2px;
  background: #eee;
}

.avatar--topic {
  width: 56px;
  height: 56px;
  flex-basis: 56px;
}

.username {
  color: var(--link);
  font-size: 14px;
  text-decoration: none;
}

.signature {
  margin-top: 2px;
  color: #9aa1a5;
  font-size: 12px;
  line-height: 1.45;
}

.signature--inline {
  color: #9aa1a5;
  font-size: 12px;
  white-space: nowrap;
}

.signature[hidden] {
  display: none !important;
}

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

.post-body {
  font-size: 17px;
  line-height: 1.85;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.inline-jump {
  color: var(--link);
  text-decoration: none;
}
.inline-jump:hover { text-decoration: underline; }

.media {
  margin-top: 16px;
  display: grid;
  gap: 10px;
  justify-items: start;
}

.media img {
  display: block;
  width: auto;
  max-width: min(820px, 100%);
  max-height: 780px;
  object-fit: contain;
}

.replies { padding-top: 10px; }

.reply {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 16px;
  padding: 14px 0 18px;
}

.reply__main { min-width: 0; }
.reply__bar {
  min-height: 25px;
  padding: 2px 7px;
  background: var(--bar-bg);
  display: flex;
  gap: 12px;
  align-items: baseline;
}
.reply__body {
  padding-top: 10px;
  font-size: 15px;
  line-height: 1.75;
}
.media--reply { margin-top: 8px; }
.media--reply img { max-width: min(560px, 100%); max-height: 520px; }

.loading,
.error {
  color: var(--muted);
  padding: 30px 0;
}
.error { color: #a33; }

.search-ad {
  position: sticky;
  top: 20px;
  min-height: 238px;
  padding: 30px 10px 14px;
  overflow: hidden;
  border: 1px solid #d9e0e3;
  border-radius: 12px;
  background: linear-gradient(180deg, #f7fbff 0%, #fff 72%);
  box-shadow: 0 5px 16px rgba(36, 74, 105, .09);
  text-align: center;
}

.search-ad__close {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 18px;
  height: 18px;
  border: 1px solid #b9c1c7;
  border-radius: 2px;
  color: #7d858b;
  background: #fff;
  font: 14px/16px Arial, sans-serif;
  cursor: default;
  user-select: none;
}

.search-ad__brand {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
}

.search-ad__brand strong {
  color: #e43b34;
  font-size: 22px;
  line-height: 1;
  letter-spacing: -1px;
}

.search-ad__paw {
  position: relative;
  display: inline-block;
  width: 30px;
  height: 27px;
}

.search-ad__paw i { position: absolute; display: block; background: #2f73d8; }
.search-ad__paw .toe { width: 7px; height: 9px; border-radius: 50%; }
.search-ad__paw .toe--1 { left: 1px; top: 6px; transform: rotate(-25deg); }
.search-ad__paw .toe--2 { left: 8px; top: 0; transform: rotate(-8deg); }
.search-ad__paw .toe--3 { left: 17px; top: 0; transform: rotate(8deg); }
.search-ad__paw .toe--4 { right: 0; top: 6px; transform: rotate(25deg); }
.search-ad__paw .pad {
  left: 7px;
  bottom: 0;
  width: 17px;
  height: 15px;
  border-radius: 52% 52% 45% 45%;
}

.search-ad p {
  margin: 18px 0 20px;
  color: #3f505c;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.65;
}

.search-ad a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 7px 10px;
  border-radius: 999px;
  color: #fff;
  background: #3177d9;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
}

.search-ad a:hover { background: #2466c3; }

@media (max-width: 720px) {
  .site-header { height: 60px; }
  .site-header__inner,
  .forum-layout { width: min(100% - 28px, 1120px); }
  .forum-layout {
    margin-top: 18px;
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .thread-shell { grid-row: 2; }
  .search-ad {
    position: relative;
    top: auto;
    grid-row: 1;
    min-height: 0;
    padding: 12px 38px 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
  }
  .search-ad__brand { flex: 0 0 auto; }
  .search-ad__brand strong { font-size: 20px; }
  .search-ad p { margin: 0; flex: 1; font-size: 13px; line-height: 1.4; }
  .search-ad p br { display: none; }
  .search-ad a { flex: 0 0 auto; }
  .search-ad__close { top: 50%; right: 9px; transform: translateY(-50%); }
  .brand { font-size: 26px; }
  .thread__title { font-size: 24px; }
  .post-body { font-size: 16px; }
  .reply { grid-template-columns: 42px minmax(0, 1fr); gap: 10px; }
  .avatar { width: 42px; height: 42px; flex-basis: 42px; }
  .reply__bar { flex-wrap: wrap; gap: 4px 10px; }
}

@media (max-width: 430px) {
  .search-ad { gap: 8px; padding-left: 10px; }
  .search-ad p { display: none; }
  .search-ad a { margin-left: auto; }
}
