:root {
  color-scheme: light;
  --ink: #202a2b;
  --muted: #57666a;
  --line: #dce3e3;
  --surface: #ffffff;
  --back: #f5f7f7;
  --accent: #0b5c55;
  --accent-soft: #e9f3f1;
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--back); color: var(--ink); line-height: 1.6; }
a { color: var(--accent); text-underline-offset: 3px; }
button, input { font: inherit; }
button { padding: .52rem 1rem; border: 1px solid var(--accent); background: var(--accent); color: white; border-radius: .5rem; cursor: pointer; }
button.secondary { border-color: var(--line); background: var(--surface); color: var(--accent); }
button:disabled { cursor: default; opacity: .45; }
:focus-visible { outline: 3px solid #437eaa; outline-offset: 2px; }
input { width: 100%; min-width: 0; padding: .5rem .7rem; color: var(--ink); background: var(--surface); border: 1px solid #a7b5b7; border-radius: .45rem; }
input::placeholder { color: #657476; }
label { display: grid; gap: .3rem; font-weight: 600; font-size: .88rem; }
label input { font-weight: 400; }
h1 { font-size: clamp(1.45rem, 4vw, 2.15rem); line-height: 1.35; margin: .12em 0 .25em; overflow-wrap: anywhere; }
p { margin: .5rem 0; }
summary { cursor: pointer; }
.site-width { width: min(calc(100% - 2rem), 920px); margin-inline: auto; }
.site-bar { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-header, .site-actions { display: flex; align-items: center; gap: 1rem; }
.site-header { justify-content: space-between; min-height: 3.75rem; }
.brand { font-weight: 750; text-decoration: none; color: var(--ink); }
.site-actions { font-size: .9rem; }
.main { padding-block: 1.85rem 3rem; }
.intro { margin-bottom: 1.1rem; }
.eyebrow { color: var(--accent); font-weight: 700; font-size: .87rem; }
.muted, .time { color: var(--muted); }
.filters, .archive-extra, .message, .login-card { background: var(--surface); border: 1px solid var(--line); border-radius: .7rem; }
.filters { display: grid; grid-template-columns: minmax(0, 2fr) 1fr 1fr auto; align-items: end; gap: .75rem; padding: .9rem; }
.filter-actions { display: flex; gap: .4rem; }
.filter-actions button { padding-inline: .7rem; white-space: nowrap; }
.archive-extra { margin-top: .9rem; padding: .75rem 1rem; }
.archive-extra summary { font-weight: 650; }
.extra-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.extra-item { min-width: 0; }
.timeline { margin-top: 1rem; }
.timeline-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.day { width: max-content; max-width: 100%; background: #e7ecec; color: #344345; border-radius: .35rem; padding: .18rem .6rem; margin: 1.2rem 0 .55rem; font-size: .85rem; font-weight: 600; }
.message { margin: 0 0 .55rem; padding: .7rem .9rem .75rem; }
.message-row { display: flex; align-items: flex-start; gap: .6rem; margin-bottom: .55rem; }
.message-row .message { min-width: 0; max-width: min(78%, calc(100% - 3.1rem)); margin: 0; }
.message-avatar { flex: none; width: 2.5rem; height: 2.5rem; border-radius: .45rem; object-fit: cover; }
.avatar-placeholder { display: grid; place-items: center; background: #e7ecec; color: var(--muted); font-weight: 650; }
.message-row-self { justify-content: flex-end; }
.message-row-self .message-avatar { order: 1; }
.message-row-self .message { background: #e1f3e8; border-color: #c5e1d2; }
.message-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.sender { overflow-wrap: anywhere; }
.time { white-space: nowrap; font-variant-numeric: tabular-nums; font-size: .82rem; }
.message-text { white-space: pre-wrap; overflow-wrap: anywhere; margin: .4rem 0 0; }
.photo-trigger { display: inline-block; max-width: 100%; margin-top: .45rem; padding: 0; background: transparent; border: 0; cursor: zoom-in; }
.photo { display: block; min-width: 4rem; min-height: 3rem; max-width: 100%; max-height: 320px; border-radius: .4rem; object-fit: contain; }
.photo-preview { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 3.5rem 1rem 1rem; border: 0; background: rgba(0, 0, 0, .88); }
.photo-preview[open] { display: grid; place-items: center; }
.photo-preview-close { position: fixed; z-index: 1; top: .8rem; right: .8rem; background: #243033; border-color: #a7b5b7; }
.preview-image { display: block; max-width: 100%; max-height: calc(100dvh - 4.5rem); object-fit: contain; }
.player { display: block; width: min(100%, 460px); margin-top: .5rem; border-radius: .35rem; }
video.player { aspect-ratio: 16/9; background: #1e2526; }
.download { display: inline-block; background: var(--accent-soft); border-radius: .4rem; padding: .4rem .6rem; margin-top: .45rem; overflow-wrap: anywhere; }
.caption, .attachment-note { font-size: .85rem; }
.caption { color: var(--muted); margin-bottom: 0; }
button.quote { display: block; text-align: left; max-width: 100%; overflow-wrap: anywhere; font-size: .86rem; margin: .4rem 0; padding: .35rem .55rem; background: #f2f5f5; color: var(--muted); border: 0; border-left: 2px solid #91adab; }
.forwarded { margin-top: .5rem; border-top: 1px solid var(--line); padding-top: .5rem; font-size: .92rem; }
.forwarded-entry { border-left: 2px solid var(--line); padding-left: .6rem; margin: .6rem 0; }
#pages { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: .45rem; margin-top: 1.25rem; }
#page-number { font-size: .88rem; padding-inline: .25rem; }
.login-body { min-height: 100vh; display: grid; align-content: start; justify-items: center; padding: min(12vh, 6rem) 1rem 1rem; }
.login-card { width: min(100%, 420px); padding: 1.65rem; }
.login-form { display: grid; gap: .85rem; margin-top: 1.25rem; }
.alert { color: #9d2325; background: #fceeed; border-radius: .4rem; padding: .5rem .65rem; }
@media (max-width: 710px) {
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .keyword, .filter-actions { grid-column: 1 / -1; }
  .message-row .message { max-width: calc(100% - 3.1rem); }
}
@media (max-width: 420px) {
  .site-width { width: calc(100% - 1.1rem); }
  .main { padding-top: 1.2rem; }
  .extra-grid { grid-template-columns: 1fr; }
  #pages button { padding-inline: .55rem; }
}
