:root {
  --bg: #f3efe7;
  --surface: #fffdf8;
  --ink: #1d1915;
  --muted: #5c534c;
  --line: #e3d8cb;
  --accent: #1a5c40;
  --accent-dark: #134832;
  --header: #1e2b27;
  --header-text: #f4efe6;
  --badge-bg: #f6ead8;
  --badge-ink: #6f4b22;
  --ok-bg: #e5f3eb;
  --ok-ink: #145238;
  --error-bg: #fdecea;
  --error-ink: #7a2420;
  --max: 52rem;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Noto Sans SC", "Source Han Sans SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;
  font-size: 16px;
  line-height: 1.65;
}

a {
  color: var(--accent-dark);
}

a:hover {
  text-decoration: underline;
}

.skip {
  position: absolute;
  left: 0.75rem;
  top: -4rem;
  background: white;
  color: var(--ink);
  padding: 0.45rem 0.7rem;
  z-index: 5;
}

.skip:focus {
  top: 0.5rem;
}

:focus-visible {
  outline: 2px solid #cfe4d8;
  outline-offset: 2px;
}

main :focus-visible,
.site-foot :focus-visible {
  outline-color: var(--accent);
}

.wrap {
  width: min(100% - 1.5rem, var(--max));
  margin-inline: auto;
}

.top {
  background: var(--header);
  color: var(--header-text);
  box-shadow: inset 0 -3px 0 var(--accent);
}

.top a {
  color: inherit;
  text-decoration: none;
}

.top-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.15rem 1rem;
  min-height: 3.4rem;
  padding: 0.35rem 0;
}

.brand {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0.2rem 0;
}

.brand-name {
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1.2;
}

.brand-sub {
  display: none;
  font-size: 0.78rem;
  opacity: 0.75;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.1rem 0.15rem;
}

.nav a,
.nav button.linkish {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.45rem;
  color: inherit;
  background: none;
  border: 0;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}

.nav a:hover,
.nav button.linkish:hover {
  text-decoration: underline;
}

.nav form {
  display: inline-flex;
  margin: 0;
}

.who {
  max-width: 8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

main {
  min-width: 0;
  padding-bottom: 2rem;
}

.lead {
  font-size: 1.05rem;
  line-height: 1.75;
  max-width: 40rem;
  margin: 1.25rem 0 1.3rem;
}

h1,
h2 {
  line-height: 1.35;
  font-weight: 700;
}

h1 {
  font-size: 1.5rem;
  margin: 0.35rem 0 0.7rem;
}

h2 {
  font-size: 1.12rem;
  margin: 1.55rem 0 0.55rem;
}

.page-head h1 {
  margin-bottom: 0.35rem;
}

.page-head p {
  margin: 0.2rem 0 0;
  max-width: 40rem;
}

.crumb {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 1rem 0 0.4rem;
}

.crumb a {
  color: inherit;
}

.hint,
.meta,
.latest,
.desc,
.empty {
  color: var(--muted);
}

.hint,
.meta,
.latest {
  font-size: 0.92rem;
}

time {
  white-space: nowrap;
}

.hint {
  margin: 0.35rem 0 0;
}

.board {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 0.9rem 1rem;
  margin: 0 0 0.55rem;
}

.board h2 {
  margin: 0 0 0.25rem;
  font-size: 1.12rem;
}

.board h2 a {
  color: inherit;
  text-decoration: none;
}

.board h2 a:hover {
  text-decoration: underline;
}

.board .desc,
.board .latest {
  margin: 0.2rem 0 0;
}

.threads {
  list-style: none;
  padding: 0;
  margin: 0.6rem 0 0;
  background: var(--surface);
  border: 1px solid var(--line);
}

.thread-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.15rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
}

.thread-row:last-child {
  border-bottom: 0;
}

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

.thread-link {
  color: var(--ink);
  font-weight: 600;
  font-size: 1.05rem;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.thread-link:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

.thread-stat {
  color: var(--muted);
  font-size: 0.92rem;
}

.badge {
  display: inline-block;
  margin-left: 0.3rem;
  padding: 0 0.35rem;
  border: 1px solid #e4c9a6;
  background: var(--badge-bg);
  color: var(--badge-ink);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.5;
  vertical-align: 0.12em;
}

.post {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 1rem 1.05rem;
  margin: 0.75rem 0;
}

.post.op {
  border-left: 4px solid var(--accent);
}

.post-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.92rem;
}

.post-body,
.prose {
  margin-top: 0.75rem;
  max-width: 40rem;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.prose {
  margin-top: 0;
}

.post-body a,
.prose a {
  overflow-wrap: anywhere;
}

.thanks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.85rem;
}

.thanks button {
  min-height: 44px;
  padding: 0.2rem 0.8rem;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}

.thanks button.thanked {
  color: var(--accent-dark);
  border-color: #b7d4c6;
  background: #f3faf6;
}

.core-panel {
  background: #f4faf6;
  border: 1px solid #d5e6dc;
  border-left: 4px solid var(--accent);
  padding: 1rem 1.05rem 1.1rem;
  margin: 1.3rem 0;
}

.core-panel h2 {
  margin-top: 0;
}

.people {
  list-style: none;
  padding: 0;
  margin: 0.3rem 0 0;
}

.people li {
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
}

.people li:last-child {
  border-bottom: 0;
}

.note {
  margin: 0.15rem 0;
}

label {
  display: block;
  font-weight: 600;
  margin: 0.95rem 0 0.3rem;
}

input[type="text"],
input[type="password"],
input:not([type]),
textarea {
  width: 100%;
  padding: 0.65rem 0.7rem;
  border: 1px solid #d3c6b6;
  border-radius: 2px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}

textarea {
  min-height: 9rem;
  resize: vertical;
  line-height: 1.6;
}

.button,
button.primary,
button.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.45rem 1rem;
  border-radius: 2px;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.button,
button.primary {
  background: var(--accent);
  color: white;
  border: 1px solid var(--accent);
}

.button:hover,
button.primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: white;
  text-decoration: none;
}

.button.secondary,
button.secondary {
  background: transparent;
  color: var(--accent-dark);
  border: 1px solid var(--accent);
}

.button.secondary:hover,
button.secondary:hover {
  background: #eef6f2;
  color: var(--accent-dark);
}

.form-actions {
  margin-top: 0.95rem;
}

.flash,
.form-error {
  padding: 0.7rem 0.85rem;
  margin: 1rem 0;
}

.flash.ok {
  background: var(--ok-bg);
  color: var(--ok-ink);
}

.flash.error,
.form-error {
  background: var(--error-bg);
  color: var(--error-ink);
}

.pager {
  display: flex;
  gap: 1rem;
  margin: 1rem 0;
}

.site-foot {
  margin-top: 1rem;
  padding: 1.2rem 0 2.4rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
}

.site-foot p {
  margin: 0.2rem 0;
}

@media (min-width: 720px) {
  .wrap {
    width: min(100% - 2rem, var(--max));
  }

  .brand-sub {
    display: block;
  }

  .thread-row {
    grid-template-columns: minmax(0, 1fr) 7.5rem 8.5rem;
    gap: 0.5rem 1rem;
    align-items: baseline;
  }

  .thread-stat {
    text-align: right;
  }

  h1 {
    font-size: 1.65rem;
  }
}

@media (max-width: 640px) {
  .stack-form .button,
  .stack-form button.primary,
  .form-actions .button,
  .core-panel .button,
  .core-panel button {
    width: 100%;
  }
}
