:root {
  color-scheme: light;
  --page-bg: #f8f3e7;
  --card-bg: #efe5d3;
  --input-bg: #fcf8ef;
  --border: #ded2be;
  --control-border: #85745c;
  --text: #483d30;
  --text-muted: #786a57;
  --text-muted-on-tint: #6b5c4a;
  --hover-bg: #f1e7d5;
  --pressed-bg: #eadbc1;
  --link: #5f9b65;
  --link-hover: #426c46;
  --link-active: #426c46;
  --link-visited: #665275;
  --primary-bg: #41653b;
  --primary-fg: #fff8eb;
  --primary-hover-bg: #34542f;
  --primary-pressed-bg: #2c4827;
  --selected-bg: #e5ead7;
  --selected-fg: #3f6036;
  --focus-ring: #526e47;
  --selection-bg: #d9e5c7;
  --selection-fg: #283924;
  --quote-bg: #f2e8d8;
  --quote-fg: #483d30;
  --tag-bg: #ede1cc;
  --tag-fg: #6b5c4a;
  --info-bg: #e3ebe9;
  --info-fg: #365b56;
  --warning-bg: #f3e4c5;
  --warning-fg: #704917;
  --error-bg: #f3ddd6;
  --error-fg: #8b392e;
  --disabled-bg: #e9deca;
  --disabled-fg: #786a57;
  --vote-up-bg: var(--selected-bg);
  --vote-up-fg: var(--selected-fg);
  --success-bg: var(--selected-bg);
  --success-fg: var(--selected-fg);
  --unread-bg: var(--warning-bg);
  --unread-fg: var(--warning-fg);
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", Georgia, serif;
  --sans:
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --feed: min(680px, 52vw);
  --rail: min(238px, calc((100vw - var(--feed)) / 2 - 42px));
  --gutter: clamp(18px, 2.25vw, 44px);
  font: 16px/1.6 var(--sans);
  background: var(--page-bg);
  color: var(--text);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page-bg: #24201c;
  --card-bg: #302a24;
  --input-bg: #29231e;
  --border: #494037;
  --control-border: #9a876d;
  --text: #f0e5d4;
  --text-muted: #b4a38c;
  --text-muted-on-tint: #c1af95;
  --hover-bg: #392f26;
  --pressed-bg: #44372b;
  --link-hover: #b2cca0;
  --link-active: #d0e1bb;
  --link-visited: #c3aed1;
  --primary-bg: #b2cca0;
  --primary-fg: #242d20;
  --primary-hover-bg: #c4dbb2;
  --primary-pressed-bg: #9fb98e;
  --selected-bg: #303b2d;
  --selected-fg: #b2cca0;
  --focus-ring: #bdd7a8;
  --selection-bg: #4b603e;
  --selection-fg: #f4f1e5;
  --quote-bg: #372f27;
  --quote-fg: #f0e5d4;
  --tag-bg: #3b3228;
  --tag-fg: #c1af95;
  --info-bg: #283934;
  --info-fg: #add3c5;
  --warning-bg: #433522;
  --warning-fg: #e8c68a;
  --error-bg: #492c28;
  --error-fg: #f1ae9f;
  --disabled-bg: #3a322a;
  --disabled-fg: #a9967f;
}
*,
*::before,
*::after {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
a {
  color: var(--link);
}
a:hover {
  color: var(--link-hover);
}
button:disabled {
  cursor: default;
}
::selection {
  background: var(--selection-bg);
  color: var(--selection-fg);
}
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
}
.skip {
  position: fixed;
  left: 8px;
  top: -100px;
  z-index: 20;
}
.skip:focus {
  top: 8px;
  background: var(--input-bg);
}
[hidden] {
  display: none !important;
}
#main {
  width: var(--feed);
  margin: auto;
  min-height: 100svh;
  padding: 38px 0 64px;
  outline: none;
  min-width: 0;
}
body[data-view="login"] #main,
body[data-view="write"] #main {
  width: 100%;
  padding: 0;
}
.glyph {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.rail {
  position: fixed;
  z-index: 4;
  width: var(--rail);
  top: 24px;
  bottom: 24px;
  color: var(--text);
  transition:
    transform 0.18s ease,
    visibility 0.18s;
}
.rail.left {
  right: calc(50% + var(--feed) / 2 + var(--gutter));
}
.rail.right {
  left: calc(50% + var(--feed) / 2 + var(--gutter));
}
.rail.is-hidden:not(.peek) {
  visibility: hidden;
}
.rail.left.is-hidden:not(.peek) {
  transform: translateX(-110vw);
}
.rail.right.is-hidden:not(.peek) {
  transform: translateX(110vw);
}
.rail-box {
  border: 1px solid var(--border);
  border-radius: 23px;
  background: var(--card-bg);
}
.left .rail-box {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 25px 14px 14px;
  overflow: auto;
}
.rail-toggle,
.edge-reveal {
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--input-bg);
  border-radius: 50%;
  padding: 0;
}
.rail-toggle {
  position: absolute;
  z-index: 1;
  top: 15px;
  width: 28px;
  height: 28px;
}
.left .rail-toggle {
  right: -12px;
}
.right .rail-toggle {
  left: -12px;
}
.rail-toggle .glyph,
.edge-reveal .glyph {
  width: 16px;
  height: 16px;
}
.edge-reveal {
  z-index: 3;
  position: fixed;
  top: 22px;
  width: 30px;
  height: 32px;
}
.edge-reveal.left {
  left: 0;
  border-radius: 0 16px 16px 0;
}
.edge-reveal.right {
  right: 0;
  border-radius: 16px 0 0 16px;
}
.brand {
  margin: 0 5px 27px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}
.brand img {
  width: 38px;
  height: 38px;
}
.brand strong {
  display: block;
  font: 700 22px/1.25 var(--serif);
  letter-spacing: 0.08em;
}
.brand small {
  display: block;
  font:
    italic 13px/1.35 Georgia,
    serif;
  color: var(--text-muted);
}
.rail-search {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 18px;
}
.rail-search .glyph {
  position: absolute;
  left: 11px;
  width: 16px;
  color: var(--text-muted);
}
.rail-search input {
  width: 100%;
  min-width: 0;
  height: 39px;
  border: 0;
  border-bottom: 1px solid var(--control-border);
  background: transparent;
  padding: 0 5px 0 37px;
  font-size: 14px;
  border-radius: 0;
}
.rail-nav {
  display: grid;
  gap: 5px;
}
.rail-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 13px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text-muted-on-tint);
  font-size: 14px;
  min-height: 42px;
}
.rail-link:hover,
.rail-link[aria-current="page"] {
  background: var(--input-bg);
  color: var(--text);
}
.rail-link[aria-current="page"] {
  font-weight: 650;
}
.rail-link.write {
  background: var(--primary-bg);
  color: var(--primary-fg);
  justify-content: center;
  margin: 20px 0;
}
.rail-link.write:hover {
  background: var(--primary-hover-bg);
}
.rail-foot {
  margin-top: auto;
  padding-top: 20px;
}
.rail-foot .mode {
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
}
.right .rail-box {
  padding: 21px 18px;
  margin-bottom: 15px;
}
.right .rail-scroll {
  overflow: auto;
  height: 100%;
  scrollbar-width: thin;
}
.rail-heading {
  font: 650 18px var(--serif);
  letter-spacing: 0.04em;
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.rail-heading .glyph {
  width: 16px;
  height: 16px;
}
.side-list {
  padding: 0;
  margin: 0;
  list-style: none;
}
.side-list li + li {
  border-top: 1px solid var(--border);
}
.side-list a,
.side-list .active-user {
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding: 10px 0;
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.side-list a:hover {
  color: var(--link-hover);
}
.side-list .rank {
  font:
    italic 14px Georgia,
    serif;
  color: var(--text-muted);
}
.side-list .count {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}
.side-note,
.feed-status {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
}
.feed-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin: 0 3px 22px;
  border-bottom: 1px solid var(--control-border);
  padding-bottom: 14px;
}
.feed-head h1 {
  font: 650 clamp(30px, 3vw, 42px) / 1.35 var(--serif);
  letter-spacing: 0.04em;
  margin: 0;
}
.feed-head time {
  font:
    14px Georgia,
    var(--serif);
  color: var(--text-muted);
  white-space: nowrap;
}
.feed-list {
  display: grid;
  gap: 13px;
}
.post-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto 1fr auto;
  align-content: start;
  column-gap: 22px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  border-radius: 20px;
  height: 204px;
  padding: 20px 24px;
  position: relative;
  transition: border-color 0.15s;
}
.post-card:hover {
  border-color: var(--control-border);
}
.post-card.has-image {
  grid-template-columns: minmax(0, 1fr) min(26%, 149px);
}
.post-card .preview {
  grid-column: 2;
  grid-row: 1/-1;
  width: 100%;
  height: 100%;
  border-radius: 9px;
  object-fit: cover;
  align-self: center;
}
.post-card h2 {
  font: 670 clamp(20px, 1.7vw, 26px) / 1.36 var(--serif);
  margin: 0;
  grid-column: 1;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}
.post-card h2 a {
  text-decoration: none;
  color: var(--text);
}
.post-card h2 a:visited {
  color: var(--text-muted);
}
.post-card h2 a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 20px;
}
.post-card .byline,
.post-card .post-counts {
  display: flex;
  gap: 7px;
  align-items: center;
  color: var(--text-muted);
  font-size: 12px;
  grid-column: 1;
  min-width: 0;
}
.byline {
  margin-top: 6px;
}
.byline .author-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mini-avatar {
  width: 19px;
  height: 19px;
  flex: none;
  border-radius: 50%;
  background: var(--tag-bg);
  object-fit: cover;
  text-align: center;
  font: 12px/19px var(--serif);
}
.post-snippet {
  margin: 7px 0 0;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-muted-on-tint);
  grid-column: 1;
  align-self: start;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.post-counts .glyph {
  width: 14px;
  height: 14px;
}
.post-counts .stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.post-counts time {
  margin-left: auto;
}
.feed-more {
  margin: 20px auto;
  display: block;
  padding: 7px 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card-bg);
}
@media (max-width: 980px) {
  :root {
    --feed: min(680px, calc(100vw - 64px));
    --rail: min(280px, 82vw);
  }
  .rail.left {
    left: 10px;
    right: auto;
  }
  .rail.right {
    right: 10px;
    left: auto;
  }
  .rail {
    top: 10px;
    bottom: 10px;
  }
  .rail.peek .rail-box {
    box-shadow: 0 6px 30px #20160a25;
  }
  .rail.right.peek .rail-scroll {
    background: var(--page-bg);
    border-radius: 23px;
  }
  .rail-toggle {
    height: 36px;
    width: 36px;
  }
  .edge-reveal {
    height: 44px;
    width: 28px;
  }
}
@media (max-width: 600px) {
  :root {
    --feed: calc(100vw - 30px);
  }
  #main {
    padding-top: 68px;
  }
  .feed-head h1 {
    font-size: 30px;
  }
  .feed-head {
    margin-bottom: 15px;
  }
  .post-card {
    height: 195px;
    padding: 17px;
    column-gap: 13px;
  }
  .post-card.has-image {
    grid-template-columns: minmax(0, 1fr) 23%;
  }
  .post-card .preview {
    height: 88px;
  }
  .feed-head time {
    font-size: 12px;
  }
  .rail-foot {
    padding-top: 8px;
  }
  .left .rail-box {
    padding-top: 18px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0s !important;
    scroll-behavior: auto !important;
  }
}
.feed-search {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding: 6px 8px 6px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--input-bg);
}
.feed-search .glyph {
  width: 16px;
  color: var(--text-muted);
}
.feed-search input {
  border: 0;
  background: transparent;
  flex: 1;
  min-width: 0;
}
.feed-search button {
  border: 0;
  border-radius: 7px;
  padding: 4px 12px;
  background: var(--card-bg);
}
.rail-foot .mode:hover {
  background: var(--input-bg);
}
.rail-link:active,
.feed-more:active {
  background: var(--pressed-bg);
}
.rail-link.write:active {
  background: var(--primary-pressed-bg);
}

/* The floating panel must enter hit-testing at its final bounds immediately. */
.rail.peek {
  transition: none;
}

.rail-link,
.rail-foot .mode {
  background: color-mix(in srgb, var(--input-bg) 42%, var(--card-bg));
  border: 1px solid var(--border);
}
.rail-foot {
  display: grid;
  gap: 5px;
}
.rail-link[aria-current="page"] {
  border-color: var(--control-border);
}
.rail-link.write {
  border-color: transparent;
}

.rail-unread {
  margin-left: auto;
  padding: 0 7px;
  min-width: 21px;
  text-align: center;
  border-radius: 12px;
  background: var(--unread-bg);
  color: var(--unread-fg);
  font: 600 12px/21px var(--sans);
  font-variant-numeric: tabular-nums;
}
