:root {
  color-scheme: light;
  --ink: #26364f;
  --muted: #66738b;
  --line: rgba(70, 88, 120, .16);
  --paper: rgba(255, 255, 255, .82);
  --paper-solid: #fffdf9;
  --blue: #88b9e6;
  --pink: #eaa7bf;
  --gold: #dfb86f;
  --green: #7fb79d;
  font-family: "Noto Serif SC", "Microsoft YaHei", Georgia, serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(145deg, #dcecff 0%, #f8e1ed 46%, #fff1dc 100%);
  overflow-x: hidden;
}

.sky-glow {
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255,255,255,.36), rgba(255,255,255,0) 38%),
    linear-gradient(115deg, rgba(136,185,230,.26), rgba(234,167,191,.22) 48%, rgba(223,184,111,.22));
}

.particles {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}

.particle {
  position: absolute;
  width: 11px;
  height: 8px;
  border-radius: 80% 20% 80% 20%;
  background: rgba(255, 210, 229, .82);
  box-shadow: 0 0 8px rgba(255,255,255,.7);
  animation: floatPetal var(--duration) linear infinite;
  animation-delay: var(--delay);
  opacity: .76;
}

.particle:nth-child(3n) { background: rgba(255, 238, 246, .9); }
.particle:nth-child(4n) { background: rgba(255, 218, 157, .78); width: 8px; height: 6px; }

@keyframes floatPetal {
  from { transform: translate(0, -20px) rotate(0deg); opacity: 0; }
  12% { opacity: .8; }
  to { transform: translate(var(--drift), 145px) rotate(330deg); opacity: .06; }
}

.site {
  width: min(1160px, calc(100% - 30px));
  margin: 0 auto;
  padding: 24px 0 58px;
}

.hero {
  padding: 16px;
  border: 1px solid rgba(255,255,255,.86);
  border-radius: 10px;
  background: rgba(255,255,255,.58);
  box-shadow: 0 18px 46px rgba(74, 95, 126, .12);
  backdrop-filter: blur(16px);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.back,
.write-button,
dialog button {
  border: 1px solid rgba(255,255,255,.82);
  border-radius: 999px;
  background: rgba(255,255,255,.62);
  color: #31415e;
  text-decoration: none;
  padding: 9px 14px;
  font: 700 14px/1.2 "Noto Serif SC", "Microsoft YaHei", serif;
  box-shadow: 0 10px 24px rgba(74, 95, 126, .12);
  cursor: pointer;
}

.write-button {
  background: linear-gradient(120deg, var(--blue), var(--pink) 62%, var(--gold));
  color: #26364f;
}

.total-pill {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid rgba(255,255,255,.82);
  border-radius: 999px;
  background: rgba(255,255,255,.62);
  color: #52657f;
  padding: 8px 13px;
  font-size: 13px;
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(74, 95, 126, .1);
}

.back:hover,
.write-button:hover,
dialog button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(74, 95, 126, .18);
}

button:disabled { opacity: .5; cursor: not-allowed; }

.filters {
  margin: 0;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.86);
  border-radius: 8px;
  background: rgba(255,255,255,.68);
  box-shadow: 0 14px 34px rgba(74,95,126,.12);
  backdrop-filter: blur(14px);
  display: grid;
  grid-template-columns: repeat(6, minmax(110px, 1fr));
  gap: 10px;
  align-items: end;
}

.filters label,
dialog label {
  display: grid;
  gap: 6px;
  color: #52657f;
  font-size: 13px;
}

.filters .search { grid-column: span 2; }

select,
input,
textarea {
  width: 100%;
  border: 1px solid rgba(85, 105, 136, .18);
  border-radius: 8px;
  background: rgba(255,255,255,.82);
  color: var(--ink);
  font: inherit;
  padding: 10px 12px;
  outline: none;
}

select:focus,
input:focus,
textarea:focus {
  border-color: rgba(136,185,230,.95);
  box-shadow: 0 0 0 3px rgba(136,185,230,.22);
}

.status {
  min-height: 26px;
  margin: 10px 0 8px;
  color: var(--muted);
  text-align: center;
}

.secret-stream {
  position: relative;
  display: grid;
  gap: 22px;
  padding: 10px 0 4px 34px;
}

.secret-stream::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 24px;
  bottom: 18px;
  width: 1px;
  background: linear-gradient(var(--blue), var(--pink) 50%, var(--gold));
}

.day-section {
  position: relative;
  display: grid;
  gap: 12px;
}

.day-marker {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: -34px;
  padding: 8px 0;
}

.day-marker::before {
  content: "";
  width: 23px;
  height: 23px;
  border-radius: 50%;
  border: 5px solid rgba(255,255,255,.86);
  background: var(--gold);
  box-shadow: 0 8px 18px rgba(74,95,126,.18);
}

.day-marker time {
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 999px;
  background: rgba(255,255,255,.76);
  color: #53627e;
  font-size: 13px;
  box-shadow: 0 10px 22px rgba(74,95,126,.1);
}

.day-marker span {
  color: #8792a7;
  font-size: 12px;
}

.secret-card {
  border: 1px solid rgba(255,255,255,.88);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255,255,255,.9), rgba(255,250,246,.78));
  box-shadow: 0 18px 42px rgba(74,95,126,.14), inset 0 1px 0 rgba(255,255,255,.9);
  padding: clamp(18px, 3vw, 28px);
  backdrop-filter: blur(12px);
}

.secret-card.author-theo { border-left: 5px solid var(--blue); }
.secret-card.author-ran { border-left: 5px solid var(--pink); }
.secret-card.author-legacy { border-left: 5px solid var(--green); }
.secret-card.is-author-match {
  box-shadow: 0 18px 42px rgba(74,95,126,.14), 0 0 0 3px rgba(223, 184, 111, .18), inset 0 1px 0 rgba(255,255,255,.9);
}

.secret-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.author-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.avatar {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #e9f3ff;
  overflow: hidden;
  font-size: 1.1rem;
}

.author-ran .avatar { background: #ffe7f0; }
.author-legacy .avatar { background: #edf6ef; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.author-text {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.author-name {
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-date {
  color: #8a95aa;
  font-size: 12px;
}

.secret-meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  border-radius: 999px;
  background: rgba(244,247,251,.92);
  color: #63708a;
  padding: 5px 9px;
  font-size: 12px;
}

.chip.private {
  background: #fff0f5;
  color: #a95073;
}

.secret-body {
  margin: 0;
  color: #34435d;
  font-size: clamp(1rem, 1.6vw, 1.13rem);
  line-height: 2;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.reply-logo,
.reply-author,
.inline-reply-head,
.thread-reply-head,
.thread-actions {
  display: flex;
  align-items: center;
}

.reply-logo {
  justify-content: center;
  gap: 4px;
  min-width: 34px;
  height: 30px;
  border: 1px solid rgba(85, 105, 136, .14);
  border-radius: 999px;
  background: rgba(255, 255, 255, .66);
  color: #52657f;
  padding: 0 8px;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(74, 95, 126, .1);
}

.reply-logo:hover {
  transform: translateY(-1px);
  background: #fff;
}

.reply-logo svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.reply-logo.small {
  width: 28px;
  min-width: 28px;
  height: 28px;
  padding: 0;
  box-shadow: none;
}

.reply-count {
  color: #7b879b;
  font-size: 11px;
  font-weight: 800;
}

.inline-replies {
  margin-top: 17px;
  padding-top: 14px;
  border-top: 1px solid rgba(70, 88, 120, .13);
}

.inline-replies-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: #59677f;
  font-size: 13px;
  font-weight: 800;
}

.inline-replies-head small {
  color: #8a95aa;
  font-size: 12px;
  font-weight: 600;
}

.inline-reply-list {
  display: grid;
  gap: 8px;
}

.inline-reply {
  margin-left: calc(var(--depth) * 16px);
  border: 1px solid rgba(85, 105, 136, .12);
  border-left: 4px solid var(--green);
  border-radius: 8px;
  background: rgba(255, 255, 255, .54);
  padding: 9px 11px;
}

.inline-reply.author-theo { border-left-color: var(--blue); background: rgba(233, 246, 255, .54); }
.inline-reply.author-ran { border-left-color: var(--pink); background: rgba(255, 238, 246, .58); }

.inline-reply.is-author-match,
.thread-reply.is-author-match {
  border-color: rgba(223, 184, 111, .36);
  box-shadow: 0 0 0 2px rgba(223, 184, 111, .14);
}

.inline-reply-head {
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
}

.inline-reply p {
  margin: 0;
  color: #3e4c66;
  font-size: 13px;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.reply-dialog {
  width: min(760px, calc(100% - 26px));
  padding: 0;
  overflow: hidden;
}

.reply-shell {
  display: grid;
  grid-template-rows: auto auto minmax(170px, 1fr) auto;
  gap: 0;
  max-height: min(84vh, 760px);
}

.thread-top,
.thread-secret,
.thread-composer {
  padding: 16px clamp(16px, 3vw, 22px);
}

.thread-top {
  border-bottom: 1px solid rgba(70, 88, 120, .12);
  background: linear-gradient(120deg, rgba(233,246,255,.86), rgba(255,238,246,.78));
}

.thread-top p {
  margin: 5px 0 0;
  color: #7a869a;
  font-size: 13px;
}

.thread-secret {
  border-bottom: 1px solid rgba(70, 88, 120, .1);
  background: rgba(255, 255, 255, .54);
}

.thread-secret span {
  color: #8a95aa;
  font-size: 12px;
  font-weight: 800;
}

.thread-secret p {
  max-height: 112px;
  margin: 7px 0 0;
  overflow: auto;
  color: #34435d;
  font-size: 14px;
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.thread-list {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 16px clamp(16px, 3vw, 22px);
  overflow: auto;
  background: rgba(250, 252, 255, .64);
}

.thread-empty {
  margin: 18px 0;
  color: #8a95aa;
  text-align: center;
}

.thread-reply {
  margin-left: calc(var(--depth) * 18px);
  border: 1px solid rgba(85, 105, 136, .13);
  border-left: 4px solid var(--green);
  border-radius: 8px;
  background: rgba(255, 255, 255, .72);
  padding: 10px 12px;
}

.thread-reply.author-theo { border-left-color: var(--blue); background: rgba(233, 246, 255, .66); }
.thread-reply.author-ran { border-left-color: var(--pink); background: rgba(255, 238, 246, .66); }

.thread-reply-head {
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}

.thread-actions {
  flex: 0 0 auto;
  justify-content: flex-end;
  gap: 8px;
  color: #7e899d;
  font-size: 12px;
}

.reply-author {
  min-width: 0;
  gap: 7px;
}

.reply-author b {
  color: #42526d;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reply-avatar {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .82);
  overflow: hidden;
  font-size: .82rem;
}

.reply-avatar img { width: 100%; height: 100%; object-fit: cover; }

.thread-reply p {
  margin: 0;
  color: #34435d;
  font-size: 14px;
  line-height: 1.85;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.thread-composer {
  display: grid;
  gap: 10px;
  border-top: 1px solid rgba(70, 88, 120, .12);
  background: #fffdf9;
}

.reply-target {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #66738b;
  font-size: 13px;
  font-weight: 800;
}

.reply-target button {
  width: 26px;
  height: 26px;
  min-height: 26px;
  border-radius: 50%;
  padding: 0;
  box-shadow: none;
}

.reply-target button[hidden] { display: none; }

.thread-composer textarea {
  min-height: 62px;
  max-height: 148px;
  line-height: 1.65;
}

.thread-composer button[type="submit"] {
  justify-self: end;
  min-height: 42px;
  border-radius: 8px;
  background: #26364f;
  color: white;
}

.empty-state {
  min-height: 280px;
  border: 1px solid rgba(255,255,255,.86);
  border-radius: 8px;
  background: rgba(255,255,255,.68);
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  padding: 28px;
  box-shadow: 0 14px 34px rgba(74,95,126,.12);
}

.empty-state b {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 1.2rem;
}

.load-more {
  min-height: 46px;
  margin: 22px auto 0;
  color: #6d7890;
  font-size: 13px;
  text-align: center;
}

.load-more.is-visible {
  display: grid;
  place-items: center;
  width: min(360px, 100%);
  padding: 12px 16px;
  border: 1px solid rgba(255,255,255,.78);
  border-radius: 999px;
  background: rgba(255,255,255,.56);
  box-shadow: 0 12px 28px rgba(74,95,126,.1);
  backdrop-filter: blur(12px);
}

dialog {
  width: min(580px, calc(100% - 28px));
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 10px;
  background: #fffdf9;
  color: var(--ink);
  box-shadow: 0 28px 80px rgba(38,54,79,.34);
}

dialog::backdrop {
  background: rgba(38,54,79,.46);
  backdrop-filter: blur(8px);
}

dialog form {
  display: grid;
  gap: 14px;
}

dialog header,
dialog footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

dialog h2 {
  margin: 0;
  font-size: 1.35rem;
}

.close {
  border: 0;
  box-shadow: none;
  background: transparent;
  padding: 4px 8px;
  font-size: 1.5rem;
}

textarea {
  min-height: 178px;
  resize: vertical;
  line-height: 1.8;
}

.check {
  display: block;
}

.check input {
  width: auto;
  height: auto;
  margin-right: 6px;
}

dialog footer {
  justify-content: flex-end;
}

dialog button[type="submit"] {
  background: #26364f;
  color: white;
}

.reply-dialog .reply-shell {
  gap: 0;
  grid-template-rows: auto auto minmax(170px, 1fr) auto;
}

.reply-dialog .thread-composer {
  display: grid;
  justify-content: stretch;
  align-items: stretch;
}

.reply-dialog .thread-composer button[type="submit"] {
  justify-self: end;
}

@media (max-width: 900px) {
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters .search { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .site { width: min(100% - 20px, 640px); padding-top: 16px; }
  .hero { padding: 12px; }
  .topbar { align-items: stretch; gap: 8px; }
  .top-actions { gap: 7px; }
  .back, .write-button, .total-pill { display: inline-flex; align-items: center; justify-content: center; padding-inline: 11px; }
  .total-pill { font-size: 12px; }
  .filters { grid-template-columns: 1fr; }
  .secret-stream { padding-left: 24px; }
  .secret-stream::before { left: 8px; }
  .day-marker { margin-left: -24px; }
  .day-marker::before { width: 18px; height: 18px; border-width: 4px; }
  .secret-head { display: grid; }
  .secret-meta { justify-content: flex-start; }
  .inline-reply { margin-left: calc(var(--depth) * 9px); }
  .inline-reply-head { align-items: flex-start; }
  .thread-reply { margin-left: calc(var(--depth) * 10px); }
  .thread-reply-head { align-items: flex-start; }
  .thread-actions { gap: 6px; }
  .thread-composer button[type="submit"] { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
