:root {
  color-scheme: light;
  --navy: #263d56;
  --navy-hover: #365571;
  --link: #365570;
  --ink: #293747;
  --muted: #606d7c;
  --red: #913d4c;
  --red-line: #ead8dd;
  --red-line-light: #f0e4e7;
  --red-line-strong: #bf8994;
  --paper: #fff;
  --canvas: #f7f8fa;
  --tint: #f2f5f9;
  --line: #e9edf2;
  --field-line: #d6dfe8;
  --radius: 13px;
  --panel-shadow: 0 2px 7px rgba(38, 61, 86, .028);
  --shell-width: min(1240px, calc(100% - 64px));
  --gap: 20px;
}

*, *::before, *::after { box-sizing: border-box; }
html {
  min-height: 100%;
  background: var(--canvas);
  -webkit-text-size-adjust: 100%;
}
body {
  min-width: 0;
  min-height: 100vh;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: 15px;
  line-height: 1.65;
}
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--red); }
a, button, input, select, textarea {
  transition: color .16s ease, background-color .16s ease, border-color .16s ease, box-shadow .16s ease;
}
:where(a, button, input, select, textarea):focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
}
button, input, select, textarea { font: inherit; }
small { color: var(--muted); }

.topbar {
  border-bottom: 1px solid var(--line);
  background: #f6f7f9;
}
.topbar-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px 20px;
  width: var(--shell-width);
  min-height: 36px;
  margin-inline: auto;
  padding-block: 6px;
  color: var(--muted);
  font-size: 12px;
}
.topbar-in > span:last-child { flex: 0 1 auto; overflow-wrap: anywhere; }
.topbar a { margin-left: 13px; color: var(--navy); font-weight: 650; }
.topbar a:hover { color: var(--red); text-decoration: underline; text-underline-offset: 3px; }

.masthead {
  border-bottom: 1px solid var(--red-line);
  background: var(--paper);
}
.head, .site-nav, .page, .admin-shell {
  width: var(--shell-width);
  margin-inline: auto;
}
.head {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(0, 525px);
  align-items: center;
  gap: 20px 42px;
  padding-block: 23px 19px;
}
.logo {
  display: block;
  justify-self: start;
  width: 166px;
  max-width: 100%;
  aspect-ratio: 1.83;
  overflow: hidden;
}
.logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.2);
}
.head-search { min-width: 0; }
.head-search form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px 8px;
}
.search-field { position: relative; min-width: 0; }
.search-field::before {
  position: absolute;
  top: calc(50% - 7px);
  left: 13px;
  width: 12px;
  height: 12px;
  border: 1.5px solid #64768a;
  border-radius: 50%;
  pointer-events: none;
  content: "";
}
.search-field::after {
  position: absolute;
  top: calc(50% + 4px);
  left: 23px;
  width: 6px;
  height: 1.5px;
  transform: rotate(45deg);
  transform-origin: left center;
  background: #64768a;
  pointer-events: none;
  content: "";
}
.head-search input[type="text"] {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 43px;
  padding: 8px 12px 8px 35px;
  border: 1px solid var(--field-line);
  border-radius: 8px;
  background: #f8f9fb;
  color: var(--ink);
  font-size: 16px;
}
.head-search input::placeholder { color: var(--muted); }
.head-search button { min-height: 43px; padding-inline: 19px; white-space: nowrap; }
.search-types {
  display: flex;
  grid-column: 1 / -1;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 14px;
}
.search-types label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 27px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  cursor: pointer;
}
.search-types label:hover, .search-types label:has(input:checked) { color: var(--navy); }
.search-types input { margin: 0; accent-color: var(--navy); }

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 28px;
}
.site-nav > a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
  white-space: nowrap;
}
.site-nav > a:hover, .site-nav > a[aria-current="page"] { color: var(--navy); }
.site-nav > a[aria-current="page"]::after {
  position: absolute;
  inset: auto 0 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--red-line-strong);
  content: "";
}
.site-nav > .nav-publish {
  gap: 6px;
  min-height: 32px;
  margin-left: auto;
  padding: 0 12px;
  border: 1px solid var(--red-line);
  border-radius: 7px;
  background: #fdf8f9;
  color: var(--red);
}
.site-nav > .nav-publish:hover { border-color: var(--red-line-strong); color: var(--red); }
.site-nav > .nav-publish::before { font-size: 16px; line-height: 1; content: "+"; }

.page { padding-bottom: 20px; }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(248px, 23vw, 286px);
  align-items: start;
  gap: var(--gap);
  margin-top: var(--gap);
}
.main, .side, .admin-main { min-width: 0; }
.banner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: start;
  justify-content: center;
  gap: 10px;
  min-height: 128px;
  margin-bottom: var(--gap);
  padding: 21px clamp(23px, 4vw, 37px);
  overflow: hidden;
  isolation: isolate;
  border: 1px solid var(--red-line);
  border-radius: var(--radius);
  background:
    radial-gradient(ellipse at 94% 80%, #f3e8ef 0, transparent 49%),
    linear-gradient(110deg, #f0f4f9, #fcf9fa);
  color: var(--navy);
}
.banner::before {
  width: 26px;
  height: 2px;
  border-radius: 2px;
  background: var(--red-line-strong);
  content: "";
}
.banner::after {
  position: absolute;
  z-index: -1;
  top: -165px;
  right: -48px;
  width: 310px;
  height: 310px;
  border: 1px solid rgba(176, 134, 151, .18);
  border-radius: 50%;
  box-shadow: 0 0 0 27px rgba(255, 255, 255, .29), 0 0 0 28px rgba(176, 134, 151, .12);
  pointer-events: none;
  content: "";
}
.banner span {
  font-size: clamp(23px, 2.25vw, 31px);
  font-weight: 760;
  letter-spacing: .037em;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.banner:hover { border-color: #dfc0c8; color: var(--navy); }

.homegrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap);
  margin-bottom: var(--gap);
}
.panel, .sidebox, .admin-card {
  min-width: 0;
  overflow: hidden;
  margin-bottom: var(--gap);
  border: 1px solid var(--red-line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--panel-shadow);
}
.homegrid .panel { margin: 0; }
.panel h2, .sidebox h3, .admin-card h2 {
  margin: 0;
  padding: 13px 17px;
  border-bottom: 1px solid var(--line);
  color: var(--navy);
  font-size: 17px;
  font-weight: 750;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.topic h2, .article-list-panel h2 { display: flex; align-items: center; gap: 8px; }
.topic h2 > span, .article-list-panel h2 > span { min-width: 0; }
.sidebox h3 { font-size: 16px; }
.panel > h3 {
  margin: 18px 16px 9px;
  color: var(--navy);
  font-size: 16px;
}
.panel-more {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 2px 1px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
}
.panel-more:hover { color: var(--red); text-decoration: underline; text-underline-offset: 3px; }

.topic ul { margin: 0; padding: 3px 17px 8px; list-style: none; }
.topic li {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 39px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}
.topic li:last-child { border-bottom: 0; }
.topic li > a {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topic li > a:hover { color: var(--red); }
.rank {
  display: inline-grid;
  flex: 0 0 22px;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  background: var(--tint);
  color: #4b6076;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.r1, .r2, .r3 { background: #faeef1; color: var(--red); }

.boards .boardrow {
  display: grid;
  grid-template-columns: 106px minmax(0, 1fr);
  gap: 8px 14px;
  padding: 12px 17px;
  border-bottom: 1px solid var(--line);
}
.boards .boardrow:last-child { border-bottom: 0; }
.boardrow b { padding-top: 3px; color: var(--navy); font-size: 14px; }
.boardrow > span { display: flex; flex-wrap: wrap; gap: 6px; }
.boardrow a {
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #f6f8fb;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.boardrow a:hover { border-color: var(--red-line); background: #fff6f7; }

.side { position: sticky; top: 14px; }
.sidebox p {
  margin: 0;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.sidebox p:last-child { border-bottom: 0; }
.sidebox p b { color: var(--navy); }
.sidebox p a { display: inline-block; }
.login-mini { padding: 13px 16px 16px; }
.login-mini p { display: flex; align-items: center; gap: 13px; padding: 0; border: 0; }
.login-mini label { display: block; margin-bottom: 9px; color: var(--ink); font-size: 13px; font-weight: 650; }

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid var(--navy);
  border-radius: 8px;
  background: var(--navy);
  color: #fff;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.4;
  cursor: pointer;
}
button:hover, .btn:hover { border-color: var(--navy-hover); background: var(--navy-hover); color: #fff; }
a.btn { min-height: 35px; }
.tools, .desc { margin: 0; padding: 12px 16px; color: var(--muted); overflow-wrap: anywhere; }
.panel > p:not([class]) { margin: 12px 16px; }
.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
  padding: 0 16px 16px;
}
.cards article {
  min-width: 0;
  min-height: 98px;
  padding: 12px 14px;
  overflow-wrap: anywhere;
  border: 1px solid var(--red-line-light);
  border-radius: 8px;
  background: #fbfcfe;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.cards article:hover, .cards article:focus-within {
  border-color: var(--red-line-strong);
  box-shadow: var(--panel-shadow);
}
.cards h4 { margin: 0 0 5px; font-size: 15px; }
.cards p { margin: 0 0 5px; color: var(--muted); font-size: 14px; }

.form form, .admin-form { padding: 16px; }
.form label, .admin-form label {
  display: block;
  margin-bottom: 12px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
}
.form input:not([type="checkbox"], [type="hidden"]), .form textarea, .form select,
.admin-form input:not([type="checkbox"], [type="hidden"]), .admin-form textarea, .admin-form select,
.bigsearch input:not([type="hidden"]), .reply textarea, .login-mini input {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 38px;
  margin-top: 5px;
  padding: 7px 10px;
  border: 1px solid var(--field-line);
  border-radius: 6px;
  background: #fcfdff;
  color: var(--ink);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.55;
}
:is(.form, .admin-form, .login-mini, .head-search, .bigsearch, .reply) :is(input, textarea, select):focus {
  border-color: var(--red-line-strong);
}
.form textarea, .admin-form textarea, .reply textarea { min-height: 110px; resize: vertical; }
.bigsearch { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 13px 16px; }
.bigsearch input:not([type="hidden"]), .reply textarea { margin: 0; }
.board-select { cursor: pointer; }
.board-select optgroup { color: var(--navy); font-weight: 700; }
.field-help { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; font-weight: 400; }

table { width: 100%; border-collapse: collapse; }
th, td {
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}
th { background: var(--tint); color: var(--navy); font-size: 13px; white-space: nowrap; }
td { font-size: 14px; }
tbody tr:nth-child(even) { background: #f9fbfd; }
tbody tr:hover { background: #f1f5fa; }
.tag {
  display: inline-block;
  margin-right: 4px;
  padding: 1px 6px;
  border: 1px solid #cbd9e7;
  border-radius: 4px;
  background: var(--tint);
  color: var(--link);
  font-size: 11px;
  line-height: 1.6;
  white-space: nowrap;
}
.tag.red { border-color: var(--red-line-light); background: #fff2f3; color: var(--red); }
.tag.ask { border-color: #e5c9a3; background: #fff7eb; color: #7c501b; }

.meta { margin: 10px 16px; color: var(--muted); font-size: 12px; }
.post {
  display: grid;
  grid-template-columns: 109px minmax(0, 1fr);
  margin: 0 16px 13px;
  border: 1px solid var(--red-line-light);
  border-radius: 8px;
  overflow: hidden;
  scroll-margin-top: 12px;
}
.post .author {
  padding: 12px 8px;
  border-right: 1px solid var(--line);
  background: var(--tint);
  color: var(--navy);
  font-size: 13px;
  text-align: center;
  overflow-wrap: anywhere;
}
.post > div:last-child { min-height: 88px; padding: 13px 16px; line-height: 1.85; overflow-wrap: anywhere; }
.post .meta { margin: 0 0 6px; }
.ops { margin: 0 16px 13px; padding: 8px; border: 1px solid var(--red-line-light); border-radius: 8px; background: #fdf6f7; }
.ops button { margin: 2px; }
.reply { margin: 14px 16px 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.reply h3 { margin: 0 0 8px; color: var(--navy); font-size: 16px; }
.report { margin-top: 10px; }
.report button { min-height: 28px; padding-inline: 8px; border-color: var(--red-line-light); background: #fff; color: var(--red); font-size: 12px; }
.report button:hover { border-color: var(--red-line-strong); background: #fff3f4; }
.mini { display: inline-block; margin: 0 12px 7px 0; }

.list-intro { margin: 0; padding: 10px 16px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.article-list { padding: 0 16px; }
.article-list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(140px, 31%);
  align-items: center;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.article-list-item:last-child { border-bottom: 0; }
.article-list-main h3 { margin: 0 0 4px; font-size: 16px; line-height: 1.5; }
.article-list-excerpt { margin: 0; color: var(--muted); font-size: 13px; }
.article-list-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 3px 9px;
  color: var(--muted);
  font-size: 12px;
}
.empty-state { padding: 36px 16px; color: var(--muted); text-align: center; }
.pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 5px;
  margin: 14px 0;
  padding: 0 12px;
}
.pager a, .pager strong {
  display: inline-grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  border: 1px solid var(--field-line);
  border-radius: 5px;
  background: #fff;
  font-size: 13px;
}
.pager a:hover { border-color: var(--red-line-strong); }
.pager strong { border-color: var(--navy); background: var(--navy); color: #fff; }
.pager .pager-nav { padding: 0 8px; }
.pager-ellipsis { padding: 0 3px; color: var(--muted); }
.flash { margin: 12px 0; padding: 9px 13px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); }
.flash.ok { color: #266445; border-color: #b4d6c5; background: #f1faf5; }
.flash.err { color: var(--red); border-color: var(--red-line); background: #fff3f4; }
footer {
  margin-top: 8px;
  padding: 13px 5px 4px;
  border-top: 1px solid var(--red-line-light);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
code { padding: 1px 5px; border: 1px solid var(--line); border-radius: 4px; background: var(--tint); }

.admin-shell {
  display: grid;
  padding-block: 20px;
  grid-template-columns: minmax(174px, 18%) minmax(0, 1fr);
  align-items: start;
  gap: var(--gap);
}
.admin-menu {
  border: 1px solid var(--red-line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--paper);
  box-shadow: var(--panel-shadow);
}
.admin-menu h1 { margin: 0; padding: 14px 15px; border-bottom: 1px solid var(--line); color: var(--navy); font-size: 18px; }
.admin-menu a { display: block; padding: 10px 13px; border-left: 2px solid transparent; color: var(--muted); font-size: 14px; }
.admin-menu a.on, .admin-menu a:hover { border-left-color: var(--red-line-strong); background: #f9eff2; color: var(--navy); }
.admin-menu a:focus-visible { outline-offset: -3px; }

.admin-card h2 { font-size: 18px; }
.admin-card > p { margin: 12px 16px; color: var(--muted); overflow-wrap: anywhere; }
.admin-card > form:not(.admin-form) { margin: 12px 16px; }
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; padding: 14px; }
.stats div { padding: 12px 6px; border: 1px solid var(--red-line-light); border-radius: 8px; background: #fafcfe; text-align: center; }
.stats b { display: block; color: var(--navy); font-size: 25px; font-variant-numeric: tabular-nums; }
.inline { display: inline; }

@media (max-width: 950px) {
  :root { --shell-width: calc(100% - 44px); --gap: 16px; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: var(--gap); }
  .sidebox { margin: 0; }
  footer { margin-top: var(--gap); }
  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
  td:first-child { min-width: 150px; white-space: normal; }
}
@media (max-width: 680px) {
  :root { --shell-width: calc(100% - 28px); --gap: 13px; }
  .topbar-in { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; font-size: 11px; }
  .topbar-in > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-in > span:last-child { max-width: 47vw; text-align: right; }
  .topbar a { margin-left: 7px; }
  .head { grid-template-columns: minmax(0, 1fr); gap: 12px; padding-block: 13px 5px; }
  .logo { width: 132px; }
  .head-search form { column-gap: 6px; }
  .head-search button { padding-inline: 11px; font-size: 13px; }
  .search-types { column-gap: 12px; }
  .site-nav { gap: 0 clamp(8px, 2.7vw, 17px); }
  .site-nav > a { min-height: 44px; font-size: 13px; }
  .site-nav > .nav-publish { min-height: 30px; gap: 3px; padding-inline: 6px; }
  .banner { min-height: 100px; padding: 17px 19px; gap: 8px; }
  .banner span { font-size: clamp(20px, 5.5vw, 24px); }
  .banner::after { right: -105px; }
  .homegrid, .side, .cards { grid-template-columns: minmax(0, 1fr); }
  .panel h2, .sidebox h3, .admin-card h2 { padding: 10px 13px; font-size: 16px; }
  .topic ul { padding-inline: 13px; }
  .topic li { min-height: 38px; padding-block: 5px; }
  .topic li > a {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-height: 1.5;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .boards .boardrow { grid-template-columns: minmax(0, 1fr); padding: 9px 12px; }
  .boardrow b { padding: 0; }
  .form input:not([type="checkbox"], [type="hidden"]), .form textarea, .form select,
  .admin-form input:not([type="checkbox"], [type="hidden"]), .admin-form textarea, .admin-form select,
  .bigsearch input:not([type="hidden"]), .reply textarea, .login-mini input { font-size: 16px; }
  .post { grid-template-columns: minmax(0, 1fr); margin-inline: 11px; }
  .post .author { padding: 6px 11px; border-right: 0; border-bottom: 1px solid var(--line); text-align: left; }
  .post > div:last-child { min-height: 0; padding: 10px 11px; }
  .article-list-item { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .article-list-meta { justify-content: flex-start; }

  .admin-shell { grid-template-columns: minmax(0, 1fr); }
  .admin-menu { display: flex; flex-wrap: wrap; }
  .admin-menu h1 { width: 100%; padding: 9px 12px; }
  .admin-menu a { padding: 7px 10px; border-left: 0; border-bottom: 2px solid transparent; font-size: 12px; }
  .admin-menu a.on, .admin-menu a:hover { border-bottom-color: var(--red-line-strong); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  a, button, input, textarea, select, .cards article { transition: none; }
}
