:root {
  --paper: #f7f5ef;
  --ink: #181817;
  --muted: #6d6b65;
  --line: #d5d1c7;
  --coral: #f05a45;
  --green: #124d36;
  --yellow: #f5bb2c;
  --blue: #78b7d3;
  --page-padding: clamp(18px, 5vw, 32px);
  --type-brand: 32px;
  --type-display: 28px;
  --type-feature: 22px;
  --type-section: 22px;
  --type-title: 16px;
  --type-body: 14px;
  --type-detail: 13px;
  --type-caption: 12px;
  --type-micro: 10px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 136px;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", system-ui, sans-serif;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

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

svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  padding: max(16px, env(safe-area-inset-top)) var(--page-padding) 0;
  border-bottom: 1px solid var(--line);
  background: rgb(247 245 239 / 0.94);
  backdrop-filter: blur(14px);
}

.header-top,
.issue-row,
.section-heading,
.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.masthead {
  font-family: "STHeiti", "PingFang SC", sans-serif;
  font-size: var(--type-brand);
  font-weight: 950;
  line-height: 1;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.archive-button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
  cursor: pointer;
}

.archive-button svg {
  width: 15px;
  height: 15px;
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.icon-button svg {
  width: 19px;
  height: 19px;
}

.issue-row {
  margin-top: 12px;
}

.issue-row p {
  margin: 0;
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: var(--type-caption);
  font-weight: 650;
}

.issue-row p span {
  color: var(--coral);
}

.issue-row p b {
  margin-left: 4px;
  padding: 2px 4px;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--green);
  font-family: "PingFang SC", "Noto Sans CJK SC", sans-serif;
  font-size: 9px;
}

.submit-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid var(--coral);
  border-radius: 4px;
  color: var(--coral);
  background: transparent;
  font-weight: 700;
  cursor: pointer;
}

.submit-button svg {
  width: 16px;
  height: 16px;
}

.section-nav {
  display: flex;
  gap: 26px;
  margin-top: 13px;
  overflow-x: auto;
  scrollbar-width: none;
}

.section-nav::-webkit-scrollbar,
.friend-scroller::-webkit-scrollbar,
.photo-strip::-webkit-scrollbar {
  display: none;
}

.section-nav a {
  position: relative;
  flex: 0 0 auto;
  padding: 0 0 12px;
  color: var(--muted);
  font-size: var(--type-detail);
  font-weight: 700;
  white-space: nowrap;
}

.section-nav a.active {
  color: var(--coral);
}

.section-nav a.active::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 3px;
  background: var(--coral);
  content: "";
}

.section-shell {
  padding: 28px var(--page-padding);
  border-bottom: 1px solid var(--line);
}

.hero-photo,
.friend-photo,
.moment-photo {
  background-color: #d9d4c9;
}

.hero-photo {
  width: 100%;
  aspect-ratio: 1.56;
  border-radius: 6px;
}

.image-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px dashed #aaa79f;
  color: #77746d;
  background: #d7d5cf;
  text-align: center;
}

.image-placeholder span {
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: 9px;
  font-weight: 750;
}

.image-placeholder strong {
  font-size: var(--type-detail);
  font-weight: 700;
}

[data-image-slot] {
  position: relative;
  overflow: hidden;
}

.published-image {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

[data-image-slot].has-published-image > span,
[data-image-slot].has-published-image > strong {
  visibility: hidden;
}

[data-image-slot][data-image-slot].has-published-image {
  border-color: transparent;
}

.headline-copy {
  padding-top: 22px;
}

.eyebrow {
  display: inline-block;
  padding: 5px 9px;
  border-radius: 3px;
  color: white;
  background: var(--coral);
  font-size: 12px;
  font-weight: 800;
}

.headline h1 {
  max-width: none;
  margin: 15px 0 10px;
  font-size: var(--type-display);
  font-weight: 900;
  line-height: 1.2;
  overflow-wrap: anywhere;
  text-wrap: pretty;
}

.headline-copy > p {
  margin: 0;
  color: #4e4c47;
  font-size: var(--type-body);
  line-height: 1.7;
}

.story-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--type-caption);
}

.story-actions,
.reaction-button,
.comment-count {
  display: flex;
  align-items: center;
}

.story-actions {
  gap: 18px;
}

.story-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: 10px;
}

.story-stat strong {
  color: var(--coral);
  font-size: 13px;
}

.reaction-button {
  gap: 6px;
  padding: 0;
  border: 0;
  color: var(--coral);
  background: transparent;
  cursor: pointer;
}

.reaction-button svg,
.comment-count svg {
  width: 18px;
  height: 18px;
}

.reaction-button[aria-pressed="true"] svg {
  fill: currentColor;
}

.comment-count {
  gap: 6px;
}

.section-heading {
  align-items: end;
  margin-bottom: 18px;
}

.section-kicker {
  margin: 0 0 4px;
  color: var(--coral);
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: var(--type-micro);
  font-weight: 800;
  letter-spacing: 0.08em;
}

.section-heading h2,
.preview h2,
.dialog-heading h2 {
  margin: 0;
  font-size: var(--type-section);
  line-height: 1.2;
}

.edition-stamp,
.ranking-badge {
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: 11px;
}

.flash-item {
  position: relative;
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 13px;
  padding: 17px 0;
  border-top: 1px solid var(--line);
}

.flash-item:last-child {
  padding-bottom: 0;
}

.avatar {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  color: var(--ink);
  font-size: 15px;
  font-weight: 850;
}

.avatar-green { background: #b9cfb5; }
.avatar-yellow { background: #f6cf60; }
.avatar-blue { background: #add6e5; }

.flash-copy {
  padding-right: 38px;
}

.flash-copy time {
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: 10px;
}

.flash-copy h3 {
  margin: 4px 0 5px;
  font-size: var(--type-title);
  line-height: 1.45;
}

.flash-copy p {
  margin: 0;
  color: var(--muted);
  font-size: var(--type-caption);
  line-height: 1.55;
}

.flash-reactions {
  position: absolute;
  top: 20px;
  right: 0;
  color: var(--muted);
  font-size: 11px;
}

.mega-events {
  background: #efede7;
}

.mega-story-list {
  display: grid;
  gap: 34px;
}

.mega-story + .mega-story {
  padding-top: 34px;
  border-top: 2px solid var(--ink);
}

.mega-story-image {
  width: 100%;
  aspect-ratio: 1.62;
  margin-bottom: 16px;
  border-radius: 4px;
}

.mega-story-labels,
.mega-story-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mega-story-labels {
  color: var(--coral);
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: 10px;
  font-weight: 800;
}

.mega-story-labels span {
  color: var(--muted);
}

.mega-story h3 {
  max-width: 22ch;
  margin: 10px 0;
  font-size: var(--type-feature);
  line-height: 1.35;
  overflow-wrap: anywhere;
  text-wrap: pretty;
}

.mega-story-lead {
  margin: 0;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  color: #4e4c47;
  font-size: var(--type-body);
  font-weight: 650;
  line-height: 1.75;
}

.mega-broadcast {
  display: grid;
  gap: 12px;
  padding: 17px 0;
}

.mega-broadcast p {
  margin: 0;
  color: var(--muted);
  font-size: var(--type-detail);
  line-height: 1.72;
}

.mega-broadcast strong {
  color: var(--ink);
}

.mega-story blockquote {
  margin: 0;
  padding: 11px 14px;
  border-left: 3px solid var(--coral);
  color: #4e4c47;
  background: rgb(255 255 255 / 0.38);
  font-family: "Kaiti SC", "STKaiti", serif;
  font-size: var(--type-body);
  line-height: 1.65;
}

.mega-story-meta {
  margin-top: 13px;
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: 9px;
}

.mega-story-meta span:first-child {
  min-width: 0;
}

.mega-story-meta span:last-child {
  flex: 0 0 auto;
  color: var(--coral);
}

.hand-note {
  color: var(--muted);
  font-family: "Kaiti SC", "STKaiti", serif;
  font-size: 13px;
  transform: rotate(-2deg);
}

.friend-scroller,
.photo-strip {
  display: flex;
  gap: 14px;
  margin-right: calc(var(--page-padding) * -1);
  padding-right: var(--page-padding);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.friend-card {
  display: flex;
  flex-direction: column;
  width: min(78vw, 310px);
  flex: 0 0 auto;
  scroll-snap-align: start;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: rgb(255 255 255 / 0.28);
}

.friend-photo {
  width: 100%;
  aspect-ratio: 1.38;
}

.friend-card-copy {
  flex: 1 1 auto;
  padding: 15px;
}

.friend-name-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.friend-name-row h3 {
  min-width: 0;
  margin: 0;
  font-size: var(--type-title);
  line-height: 1.35;
}

.status {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.status::before {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
  content: "";
}

.status-online::before { background: #69b37b; }
.status-busy::before { background: var(--yellow); }
.status-away::before { background: #48a5ce; }

.friend-card-copy > p {
  min-height: 118px;
  margin: 10px 0 15px;
  color: var(--muted);
  font-size: var(--type-detail);
  line-height: 1.55;
}

.mini-like {
  padding: 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  cursor: pointer;
}

.mini-like[aria-pressed="true"] {
  color: var(--coral);
}

.card-footnote {
  color: var(--coral);
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: 10px;
}

.photo-strip figure {
  display: flex;
  flex-direction: column;
  width: min(66vw, 260px);
  flex: 0 0 auto;
  margin: 0;
  scroll-snap-align: start;
}

.moment-photo {
  aspect-ratio: 1.15;
  border-radius: 4px;
}

.photo-strip figcaption {
  flex: 1 1 auto;
  margin-top: 8px;
  color: var(--muted);
  font-family: "Kaiti SC", "STKaiti", serif;
  font-size: 12px;
}

.ranking {
  color: #f8f6ef;
  background: var(--green);
}

.ranking .section-kicker {
  color: #f6ca65;
}

.ranking-badge {
  color: rgb(255 255 255 / 0.6);
}

.ranking-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ranking-list li {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 11px;
  min-height: 72px;
  border-top: 1px solid rgb(255 255 255 / 0.22);
}

.rank-number {
  color: #f6ca65;
  font-family: Georgia, serif;
  font-size: 21px;
  font-style: italic;
}

.ranking-list div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ranking-list strong {
  font-size: var(--type-body);
  line-height: 1.35;
}

.ranking-list div span,
.winner {
  color: rgb(255 255 255 / 0.58);
  font-size: 11px;
}

.winner {
  color: white;
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: 12px;
  font-weight: 800;
}

.hotwords {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgb(255 255 255 / 0.22);
}

.hotwords p {
  margin: 0 0 11px;
  color: #f6ca65;
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: 10px;
  font-weight: 800;
}

.hotwords div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hotwords span {
  padding: 6px 8px;
  border: 1px solid rgb(255 255 255 / 0.28);
  border-radius: 3px;
  color: rgb(255 255 255 / 0.82);
  font-size: 11px;
}

.preview {
  padding: 0;
  background: #f6c13d;
}

.preview-label {
  padding: 24px var(--page-padding) 16px;
}

.preview .section-kicker {
  color: var(--green);
}

.preview-event {
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 15px;
  align-items: center;
  padding: 18px var(--page-padding) 24px;
  border-top: 1px solid rgb(24 24 23 / 0.17);
}

.preview-event + .preview-event {
  border-top: 1px solid rgb(24 24 23 / 0.17);
}

.calendar-tile {
  display: grid;
  min-height: 65px;
  place-items: center;
  border: 1px solid rgb(24 24 23 / 0.34);
  border-radius: 4px;
  background: #f8e5ad;
}

.calendar-tile span {
  align-self: end;
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: 9px;
}

.calendar-tile strong {
  align-self: start;
  font-family: Georgia, serif;
  font-size: 28px;
}

.preview-event p,
.preview-event h3 {
  margin: 0;
}

.preview-event p,
.preview-event > div > span {
  color: rgb(24 24 23 / 0.6);
  font-size: 11px;
  line-height: 1.55;
}

.preview-event h3 {
  margin: 4px 0 7px;
  font-size: var(--type-title);
  line-height: 1.4;
}

.closing {
  padding-top: 48px;
  padding-bottom: 50px;
  text-align: center;
}

.closing > p {
  margin: 0;
  color: var(--coral);
  font-family: "Kaiti SC", "STKaiti", serif;
}

.closing h2 {
  margin: 14px auto 23px;
  font-size: var(--type-feature);
  line-height: 1.35;
  text-wrap: pretty;
}

.closing > .closing-note {
  max-width: 32em;
  margin: -8px auto 24px;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  line-height: 1.7;
}

.submit-button-dark {
  min-height: 44px;
  border-color: var(--ink);
  color: var(--paper);
  background: var(--ink);
}

footer {
  display: flex;
  justify-content: space-between;
  padding: 20px var(--page-padding) calc(20px + env(safe-area-inset-bottom));
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: 10px;
}

.archive-dialog {
  width: min(calc(100% - 28px), 440px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--ink);
  border-radius: 6px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 18px 80px rgb(0 0 0 / 0.22);
}

.archive-dialog::backdrop {
  background: rgb(24 24 23 / 0.5);
  backdrop-filter: blur(3px);
}

.archive-dialog form {
  display: grid;
  gap: 18px;
  max-height: calc(100dvh - 28px);
  padding: 22px;
}

.archive-dialog .icon-button {
  width: 36px;
  height: 36px;
  flex-basis: 36px;
}

.archive-list {
  overflow-y: auto;
  border-bottom: 1px solid var(--line);
}

.archive-all-link {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
}

.archive-all-link:hover,
.archive-all-link:focus-visible {
  border-color: var(--coral);
  color: var(--coral);
}

.archive-issue {
  display: grid;
  grid-template-columns: 55px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  min-height: 72px;
  border-top: 1px solid var(--line);
}

.archive-issue > div {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.archive-issue strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.archive-issue > div span,
.archive-volume,
.archive-state {
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: 9px;
}

.archive-volume {
  color: var(--coral);
  font-weight: 800;
}

.archive-state {
  padding: 3px 5px;
  border: 1px solid var(--line);
  border-radius: 2px;
}

.archive-issue > svg {
  width: 16px;
  height: 16px;
  color: var(--coral);
}

.archive-issue.is-current {
  opacity: 0.62;
}

.submit-dialog {
  width: min(calc(100% - 28px), 440px);
  max-height: calc(100dvh - 28px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--ink);
  border-radius: 6px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 18px 80px rgb(0 0 0 / 0.22);
  overflow-y: auto;
}

.submit-dialog::backdrop {
  background: rgb(24 24 23 / 0.5);
  backdrop-filter: blur(3px);
}

.submit-dialog form {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.dialog-heading {
  align-items: start;
  margin-bottom: 3px;
}

.dialog-heading .icon-button {
  width: 36px;
  height: 36px;
  flex-basis: 36px;
}

.submit-dialog label {
  display: grid;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
}

.upload-group {
  display: grid;
  gap: 8px;
}

.upload-title {
  font-size: 12px;
  font-weight: 700;
}

.upload-title small {
  margin-left: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.submit-dialog .image-upload {
  display: flex;
  min-height: 68px;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px dashed #aaa79f;
  border-radius: 3px;
  color: var(--muted);
  background: #efede7;
  cursor: pointer;
}

.image-upload svg {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  color: var(--coral);
}

.image-upload > span {
  display: grid;
  gap: 2px;
}

.image-upload strong {
  color: var(--ink);
  font-size: 13px;
}

.image-upload small {
  font-size: 10px;
  font-weight: 500;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.image-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.preview-image {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #e1dfd8;
}

.preview-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-image button {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: white;
  background: rgb(24 24 23 / 0.78);
  cursor: pointer;
}

.preview-image button svg {
  width: 13px;
  height: 13px;
}

.submit-dialog input:not([type="file"]),
.submit-dialog textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 3px;
  outline: 0;
  color: var(--ink);
  background: #fffdf8;
  font-size: 14px;
}

.submit-dialog input:not([type="file"]) {
  height: 44px;
  padding: 0 12px;
}

.submit-dialog textarea {
  padding: 12px;
  resize: vertical;
}

.submit-dialog input:not([type="file"]):focus,
.submit-dialog textarea:focus {
  border-color: var(--coral);
  box-shadow: 0 0 0 2px rgb(240 90 69 / 0.12);
}

.form-submit {
  min-height: 46px;
  border: 0;
  border-radius: 3px;
  color: white;
  background: var(--coral);
  font-weight: 800;
  cursor: pointer;
}

.toast {
  position: fixed;
  z-index: 30;
  right: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  left: 20px;
  padding: 13px 16px;
  border-radius: 4px;
  color: white;
  background: var(--ink);
  font-size: 13px;
  text-align: center;
  opacity: 0;
  transform: translateY(16px);
  transition: 180ms ease;
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (min-width: 760px) {
  :root {
    --type-brand: 38px;
    --type-display: 30px;
    --type-feature: 24px;
  }

  body {
    max-width: 760px;
    margin: 0 auto;
    border-right: 1px solid var(--line);
    border-left: 1px solid var(--line);
  }

  .headline {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px;
  }

  .headline-copy {
    padding-top: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
