:root {
  --bg: #edf1f3;
  --card: #fff;
  --ink: #283238;
  --muted: #8a969e;
  --line: #e3e9ed;
  --blue: #42a5f5;
  --cyan: #43d2e7;
  --coral: #ff5c61;
  --shadow: 0 4px 18px rgba(37, 55, 68, .11);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", Arial, sans-serif;
  transition: color .2s, background .2s;
}

body.dark {
  --bg: #15191d;
  --card: #20262b;
  --ink: #e8eef1;
  --muted: #96a2a9;
  --line: #30383e;
  --shadow: 0 5px 20px rgba(0,0,0,.28);
}

button, a { color: inherit; }
button { font: inherit; }

.site-header {
  height: 78px;
  color: white;
  background: linear-gradient(105deg, #438ef1 0%, #43c4ed 58%, #45d8e8 100%);
}
.header-inner {
  width: min(1320px, calc(100% - 56px));
  height: 100%;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  color: var(--blue);
  border-radius: 50%;
  background: white;
  font-family: Georgia, serif;
  font-size: 22px;
  font-style: italic;
  font-weight: 700;
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 18px; font-weight: 650; }
.brand small { margin-top: 3px; color: rgba(255,255,255,.88); font-size: 11px; }
nav { display: flex; align-items: center; gap: 34px; }
.nav-button, .theme-toggle { padding: 8px 0; border: 0; color: rgba(255,255,255,.88); background: transparent; font-size: 14px; cursor: pointer; }
.nav-button:hover, .nav-button.active { color: white; text-shadow: 0 1px 8px rgba(0,0,0,.15); }
.theme-toggle { width: 38px; height: 38px; padding: 0; border-radius: 50%; background: rgba(255,255,255,.16); font-size: 18px; }

main {
  width: min(760px, calc(100% - 68px));
  margin: 0 auto;
  padding: 24px 0 80px;
}

.post {
  position: relative;
  margin: 0 0 18px;
  animation: rise .4s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.post-avatar {
  position: absolute;
  top: 12px;
  left: -62px;
  z-index: 2;
}
.avatar {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  color: white;
  border: 3px solid var(--bg);
  border-radius: 50%;
  background: linear-gradient(145deg, #506b84, #1f3549);
  box-shadow: 0 2px 7px rgba(26,47,64,.2);
  font-family: Georgia, serif;
  font-size: 18px;
  font-weight: 700;
}
.post-card {
  overflow: hidden;
  padding: 17px 20px 15px;
  border: 1px solid rgba(210,219,225,.65);
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.post-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 13px; }
.post-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.post-detail::before { content: "·"; margin-right: 8px; }
.post-kind { color: var(--muted); font-size: 11px; }
.post-kind::before { content: "•••"; letter-spacing: 2px; }
.post-kind { font-size: 0; }

.post-content { color: var(--ink); font-size: 16px; line-height: 1.8; }
.post-content p { margin: 0 0 6px; }
.post-content .title { font-size: 22px; font-weight: 650; line-height: 1.35; }
.post-content a { color: var(--blue); text-underline-offset: 3px; }
.post-content code { padding: 2px 5px; border-radius: 4px; background: var(--bg); }

.post-media {
  width: 100%;
  margin: 15px auto 0;
}
.photo-grid {
  display: grid;
  grid-template-columns: 1.45fr .75fr;
  gap: 3px;
  overflow: hidden;
  border-radius: 10px;
  background: var(--line);
}
.photo-grid a { min-width: 0; overflow: hidden; background: var(--bg); }
.photo-grid img { display: block; width: 100%; height: 100%; min-height: 190px; object-fit: cover; }
.photo-grid a:first-child { grid-row: span 2; }
.photo-grid a:first-child img { min-height: 470px; }
.photo-grid.count-1 { grid-template-columns: 1fr; }
.photo-grid.count-1 a:first-child { grid-row: auto; }
.photo-grid.count-1 img { min-height: 380px; max-height: 650px; object-fit: contain; background: #e8ecef; }
.photo-grid.count-2 { grid-template-columns: 1fr 1fr; }
.photo-grid.count-2 a:first-child { grid-row: auto; }
.photo-grid.count-2 img { min-height: 340px; }

.video-card {
  position: relative;
  min-height: 330px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #0d1012;
}
.video-card video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #0d1012; }
.video-card::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(transparent 65%, rgba(0,0,0,.6)); transition: opacity .2s; }
.video-card.is-playing::after { opacity: 0; }
.play-button {
  position: relative;
  z-index: 2;
  width: 62px;
  height: 62px;
  color: white;
  border: 2px solid rgba(255,255,255,.9);
  border-radius: 50%;
  background: rgba(22,37,48,.45);
  backdrop-filter: blur(8px);
  font-size: 21px;
  cursor: pointer;
  transition: opacity .2s, visibility .2s;
}
.video-card.is-playing .play-button { opacity: 0; visibility: hidden; pointer-events: none; }
@media (hover: hover) and (pointer: fine) {
  .video-card.is-playing:hover .play-button,
  .video-card.is-playing:focus-within .play-button { opacity: 1; visibility: visible; pointer-events: auto; }
}
.video-caption { position: absolute; z-index: 2; left: 13px; bottom: 11px; color: white; font-size: 10px; }
.fullscreen-button {
  position: absolute;
  z-index: 3;
  right: 12px;
  bottom: 10px;
  width: 35px;
  height: 35px;
  padding: 0;
  color: white;
  border: 1px solid rgba(255,255,255,.65);
  border-radius: 50%;
  background: rgba(16,28,36,.52);
  backdrop-filter: blur(7px);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.fullscreen-button:hover { background: rgba(66,165,245,.88); }
.video-card:fullscreen { width: 100vw; height: 100vh; border-radius: 0; }
.video-card:fullscreen video { object-fit: contain; }

.music-card {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) 54px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: color-mix(in srgb, var(--card) 92%, var(--blue));
}
.album { width: 50px; height: 50px; display: grid; place-items: center; color: white; border-radius: 9px; background: linear-gradient(145deg, #7ea6c4, #3c5a70); }
.music-card.is-playing .album { animation: pulse 1.5s ease-in-out infinite alternate; }
@keyframes pulse { to { filter: brightness(1.18); } }
.music-info { min-width: 0; padding: 0 12px; }
.music-info strong, .music-info span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music-info strong { font-size: 15px; }
.music-info span { margin-top: 4px; color: var(--muted); font-size: 11px; }
.music-card audio { display: none; }
.music-play { width: 42px; height: 42px; border: 0; border-radius: 50%; color: var(--blue); background: #e8f4ff; font-size: 17px; cursor: pointer; }
.progress { height: 3px; margin-top: 10px; border-radius: 3px; background: var(--line); }
.progress i { display: block; width: 0; height: 100%; border-radius: 3px; background: var(--blue); }

.post-footer { min-height: 28px; margin-top: 13px; display: flex; justify-content: space-between; align-items: center; }
.tags { display: flex; flex-wrap: wrap; gap: 9px; }
.tag { padding: 0; border: 0; color: var(--blue); background: transparent; font-size: 12px; cursor: pointer; }
.post-actions { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.post-actions button { padding: 3px 0; border: 0; color: var(--muted); background: transparent; font-size: 12px; cursor: pointer; }
.post-actions button:hover { color: var(--blue); }
.post-actions .like-button.liked { color: var(--coral); }

.comments-panel { margin: 12px -20px -15px; padding: 14px 20px 17px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--card) 92%, var(--bg)); }
.comments-list { display: grid; gap: 12px; }
.comment-item { display: grid; grid-template-columns: 30px 1fr; gap: 9px; }
.comment-avatar { width: 30px; height: 30px; display: grid; place-items: center; color: white; border-radius: 50%; background: #8299a8; font-size: 11px; font-weight: 700; }
.comment-body { min-width: 0; }
.comment-author { color: var(--blue); font-size: 12px; font-weight: 650; }
.comment-time { margin-left: 7px; color: var(--muted); font-size: 10px; }
.comment-text { margin-top: 3px; font-size: 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.comments-empty { padding: 6px 0; color: var(--muted); font-size: 12px; text-align: center; }
.comment-form { margin-top: 13px; display: flex; align-items: flex-end; gap: 9px; }
.comment-form textarea { flex: 1; min-height: 42px; resize: vertical; padding: 9px 11px; color: var(--ink); border: 1px solid var(--line); border-radius: 9px; background: var(--card); font: inherit; font-size: 14px; line-height: 1.5; }
.comment-form button, .submit-button { padding: 9px 16px; border: 0; border-radius: 8px; color: white; background: var(--blue); cursor: pointer; }

.dialog { padding: 0; border: 0; border-radius: 14px; background: transparent; }
.dialog::backdrop { background: rgba(24,34,40,.48); backdrop-filter: blur(2px); }
.dialog-card { position: relative; width: min(390px, calc(100vw - 36px)); padding: 28px; border-radius: 14px; background: var(--card); box-shadow: 0 18px 60px rgba(0,0,0,.25); }
.dialog-card h2 { margin: 0; font-size: 22px; }
.dialog-card p { margin: 8px 0 20px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.dialog-card label { display: grid; gap: 6px; margin-top: 13px; color: var(--muted); font-size: 12px; }
.dialog-card input { width: 100%; padding: 10px 11px; color: var(--ink); border: 1px solid var(--line); border-radius: 8px; background: var(--card); font: inherit; }
.dialog-close { position: absolute; top: 10px; right: 12px; border: 0; color: var(--muted); background: transparent; font-size: 23px; cursor: pointer; }
.form-error { min-height: 18px; margin: 8px 0; color: var(--coral); font-size: 12px; }
.submit-button { width: 100%; }

.profile-card {
  margin-top: 22px;
  padding: 15px 20px;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 300px;
  gap: 12px;
  align-items: center;
  border: 1px solid rgba(210,219,225,.65);
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.profile-avatar { width: 54px; height: 54px; border-color: var(--card); }
.profile-identity strong { display: block; font-size: 18px; }
.profile-identity p { margin: 3px 0; color: var(--muted); font-size: 12px; }
.profile-identity small { color: var(--muted); font-size: 11px; }
.profile-card dl { margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); }
.profile-card dl div { min-height: 45px; padding-left: 15px; display: grid; align-content: center; border-left: 1px solid var(--line); }
.profile-card dt { color: var(--muted); font-size: 10px; }
.profile-card dd { margin: 5px 0 0; font-size: 13px; font-weight: 650; }

.floating-action {
  position: fixed;
  right: 42px;
  bottom: 38px;
  z-index: 5;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  color: white;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 5px 16px rgba(255,92,97,.35);
  text-decoration: none;
  font-size: 25px;
}
.status-card { padding: 80px 20px; text-align: center; color: var(--muted); border-radius: 12px; background: var(--card); box-shadow: var(--shadow); }
.status-card strong { display: block; margin-bottom: 8px; color: var(--ink); font-size: 21px; }
.status-card p { margin: 0; font-size: 13px; }
.empty-mark { display: block; color: var(--blue); font-size: 34px; }
.load-more { display: block; margin: 28px auto; padding: 10px 18px; border: 0; border-radius: 99px; color: white; background: var(--blue); cursor: pointer; }

footer {
  width: min(760px, calc(100% - 68px));
  margin: auto;
  padding: 10px 0 38px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
}
footer a { color: var(--blue); }

@media (min-width: 761px) and (max-width: 1024px) {
  .header-inner { width: calc(100% - 42px); }
  nav { gap: 24px; }
  main, footer { width: min(720px, calc(100% - 84px)); }
  .post-content { font-size: 17px; line-height: 1.85; }
  .video-card { min-height: 43vw; }
}

@media (max-width: 760px) {
  .site-header { height: 66px; }
  .header-inner { width: calc(100% - 28px); }
  .brand-mark { width: 39px; height: 39px; font-size: 18px; }
  .brand strong { font-size: 16px; }
  .brand small, .nav-button { display: none; }
  nav { gap: 0; }
  .theme-toggle { width: 35px; height: 35px; }
  main { width: calc(100% - 36px); padding: 16px 0 60px; }
  .post { margin-bottom: 15px; }
  .post-avatar { display: none; }
  .post-card { padding: 14px 14px 13px; border-radius: 11px; }
  .post-meta { display: grid; gap: 2px; font-size: 11px; }
  .post-detail::before { display: none; }
  .post-content { font-size: 17px; line-height: 1.85; }
  .post-content .title { font-size: 22px; }

  /* Center all media with equal left and right space. */
  .post-media {
    width: calc(100% - 2px);
    margin-left: auto;
    margin-right: auto;
  }
  .photo-grid { grid-template-columns: 1fr 1fr; }
  .photo-grid a:first-child { grid-column: span 2; grid-row: auto; }
  .photo-grid a:first-child img { min-height: 340px; }
  .photo-grid img { min-height: 150px; }
  .photo-grid.count-1 img { min-height: 390px; max-height: 590px; }
  .photo-grid.count-2 img { min-height: 260px; }
  .video-card { width: 100%; min-height: 61vw; }
  .play-button { width: 56px; height: 56px; font-size: 19px; }
  .fullscreen-button { right: 9px; bottom: 8px; width: 34px; height: 34px; }
  .music-card { width: 100%; grid-template-columns: 55px minmax(0, 1fr) 48px; padding: 9px; }
  .album { width: 45px; height: 45px; }
  .music-info { padding: 0 8px; }
  .music-play { width: 38px; height: 38px; }
  .profile-card { grid-template-columns: 55px minmax(0, 1fr); padding: 14px; }
  .profile-card dl { grid-column: 1 / -1; margin-top: 10px; }
  .profile-card dl div { padding-left: 10px; }
  .comments-panel { margin: 12px -14px -13px; padding: 13px 14px 15px; }
  .post-actions { gap: 14px; }
  .floating-action { right: 20px; bottom: 20px; width: 52px; height: 52px; }
  footer { width: calc(100% - 36px); padding-bottom: 84px; gap: 15px; }
}
