:root {
  --ink: #f2f6ff;
  --muted: #b5bed3;
  --paper: #111525;
  --panel: rgba(31, 36, 58, 0.78);
  --panel-strong: rgba(37, 43, 68, 0.92);
  --line: rgba(255, 255, 255, 0.14);
  --pink: #ff6fae;
  --cyan: #32c7d9;
  --yellow: #ffd66b;
  --violet: #8a7cf6;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  --body-bg:
    radial-gradient(circle at 12% 6%, rgba(255, 111, 174, 0.22), transparent 28rem),
    radial-gradient(circle at 92% 14%, rgba(50, 199, 217, 0.18), transparent 26rem),
    radial-gradient(circle at 50% 100%, rgba(138, 124, 246, 0.16), transparent 30rem),
    linear-gradient(180deg, #101421 0%, #171b2d 46%, #111525 100%);
  --header-bg: rgba(16, 20, 33, 0.86);
  --nav-text: #c6cedd;
  --control-bg: rgba(255, 255, 255, 0.08);
  --room-overlay: linear-gradient(180deg, rgba(11, 14, 24, 0.14), rgba(11, 14, 24, 0.74));
}

html[data-theme="light"] {
  --ink: #202536;
  --muted: #667085;
  --paper: #f8f5fb;
  --panel: rgba(255, 255, 255, 0.74);
  --panel-strong: rgba(255, 255, 255, 0.9);
  --line: rgba(60, 64, 90, 0.16);
  --shadow: 0 24px 70px rgba(92, 91, 116, 0.18);
  --body-bg:
    radial-gradient(circle at 10% 4%, rgba(255, 111, 174, 0.18), transparent 27rem),
    radial-gradient(circle at 92% 12%, rgba(50, 199, 217, 0.18), transparent 28rem),
    linear-gradient(180deg, #fff7fb 0%, #f4fbff 46%, #f8f5fb 100%);
  --header-bg: rgba(255, 250, 254, 0.86);
  --nav-text: #576071;
  --control-bg: rgba(255, 255, 255, 0.72);
  --room-overlay: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(20, 24, 36, 0.66));
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  line-height: 1.7;
  background: var(--body-bg);
}

a { color: inherit; text-decoration: none; }
p { margin: 0; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px clamp(18px, 4vw, 52px);
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 900;
}

.brand span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-mark,
.avatar-shell {
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--pink), var(--cyan));
}

.brand-mark {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  padding: 3px;
  overflow: hidden;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.site-nav a {
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--nav-text);
  font-size: 0.9rem;
  font-weight: 800;
}

.site-nav a:hover,
.site-nav a:focus-visible,
body[data-page="home"] .site-nav a[data-nav="home"],
body[data-page="about"] .site-nav a[data-nav="about"],
body[data-page="notes"] .site-nav a[data-nav="notes"],
body[data-page="articles"] .site-nav a[data-nav="articles"],
body[data-page="ask"] .site-nav a[data-nav="ask"],
body[data-page="archive"] .site-nav a[data-nav="archive"],
body[data-page="moments"] .site-nav a[data-nav="moments"],
body[data-page="friends"] .site-nav a[data-nav="friends"] {
  color: var(--ink);
  background: rgba(255, 111, 174, 0.18);
  outline: none;
}

.site-nav .nav-extra {
  display: inline-flex;
}

.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control-bg);
}

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--control-bg);
  cursor: pointer;
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.owner-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin: 0 4px;
  padding: 2px 8px;
  border: 1px solid rgba(255, 214, 107, 0.46);
  border-radius: 999px;
  color: #ffe59a;
  background: rgba(255, 214, 107, 0.13);
  font-size: 0.72rem;
  font-weight: 900;
  vertical-align: middle;
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 4px auto;
  border-radius: 99px;
  background: var(--ink);
}

.home-hero,
.page-main,
.section {
  width: min(1120px, calc(100% - 36px));
  margin: 0 auto;
}

.home-hero {
  min-height: calc(100svh - 65px);
  display: grid;
  align-items: center;
  padding: clamp(46px, 8vw, 92px) 0;
}

.page-main {
  padding-bottom: 70px;
}

.page-hero {
  padding: clamp(48px, 8vw, 86px) 0 28px;
}

.about-hero {
  min-height: 430px;
  display: grid;
  align-content: end;
  padding: clamp(52px, 9vw, 92px);
  margin-top: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #fff;
  background:
    linear-gradient(90deg, rgba(12, 16, 28, 0.72), rgba(12, 16, 28, 0.18)),
    url("assets/about-bg.png");
  background-size: cover;
  background-position: center;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.about-hero .eyebrow {
  display: none;
}

.about-hero p:not(.eyebrow) {
  color: rgba(255, 255, 255, 0.88);
  max-width: 760px;
  font-size: clamp(1.65rem, 3.8vw, 3.2rem);
  font-weight: 900;
  line-height: 1.2;
  text-shadow: 0 10px 28px rgba(0, 0, 0, 0.46);
}

.page-hero h1,
.hero-main h2 {
  margin: 0;
  max-width: 820px;
  font-size: clamp(2.3rem, 6vw, 4.8rem);
  line-height: 1.06;
  letter-spacing: 0;
}

.page-hero p:not(.eyebrow),
.hero-main p {
  max-width: 760px;
  margin-top: 20px;
  color: var(--muted);
  font-size: 1.08rem;
}

.profile-card,
.hero-main,
.glass-card,
.note-item,
.article-card,
.ask-form,
.social-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-profile {
  width: min(100%, 1040px);
  min-height: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  padding: clamp(26px, 4.8vw, 52px);
  color: rgba(255, 255, 255, 0.92);
  background:
    linear-gradient(135deg, rgba(37, 42, 69, 0.94), rgba(54, 58, 88, 0.8)),
    rgba(36, 42, 64, 0.86);
  transition: transform 180ms ease, border-color 180ms ease;
  overflow: hidden;
}

.hero-profile:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 111, 174, 0.36);
}

.profile-head {
  display: grid;
  grid-template-columns: 172px 1fr;
  gap: clamp(24px, 4vw, 42px);
  align-items: start;
}

.avatar-shell {
  width: 172px;
  height: 172px;
  padding: 7px;
  flex: 0 0 auto;
  overflow: hidden;
  background: linear-gradient(135deg, #8a5cff, var(--pink));
  box-shadow: 0 18px 38px rgba(119, 93, 255, 0.28);
}

.avatar-shell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
}

.profile-text {
  min-width: 0;
}

.hero-profile h1,
.profile-text h1 {
  margin: 0;
  color: #fff;
  font-family: Georgia, "Times New Roman", "Microsoft YaHei", serif;
  font-size: clamp(3.2rem, 7vw, 6.8rem);
  line-height: 1.05;
}

.profile-line {
  color: rgba(255, 255, 255, 0.96);
  font-weight: 900;
  font-size: clamp(1.1rem, 2.1vw, 1.65rem);
}

.profile-desc,
.card-link,
.glass-card p,
.note-item p,
.article-card p,
.discussion-preview p {
  color: var(--muted);
}

.hero-profile .eyebrow {
  color: #c8b8ff;
}

.hero-profile .profile-desc {
  color: rgba(255, 255, 255, 0.76);
  max-width: 680px;
  font-size: clamp(1rem, 1.45vw, 1.18rem);
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 22px 0;
  text-align: center;
}

.profile-stats a {
  display: grid;
  gap: 3px;
  color: rgba(255, 255, 255, 0.64);
  font-size: 0.9rem;
  font-weight: 800;
  overflow-wrap: anywhere;
  padding: 10px 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.profile-stats a:hover,
.profile-stats a:focus-visible {
  color: #fff;
  transform: translateY(-2px);
  border-color: rgba(191, 124, 255, 0.28);
  background: rgba(255, 255, 255, 0.05);
  outline: none;
}

.profile-stats em {
  font-style: normal;
  line-height: 1.18;
}

.profile-stats strong {
  color: #bf7cff;
  font-size: clamp(1.65rem, 3vw, 2.45rem);
  line-height: 1;
}

.icon-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.icon-links a {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  color: rgba(255, 255, 255, 0.88);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  font-weight: 900;
}

.app-link svg {
  width: 30px;
  height: 30px;
  fill: currentColor;
}

.qq-badge {
  width: 38px;
  height: 38px;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.18));
}

.qq-body {
  fill: #12a8ff;
}

.brand-glyph {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-size: 1.22rem;
  line-height: 1;
}

.xhs-glyph {
  font-size: 0.78rem;
}

.github-link {
  color: #ffffff;
  background: #24292f;
}

.zhihu-link {
  color: #ffffff;
}

.xhs-link {
  color: #ffffff;
}

.mail-link {
  color: #ffffff;
  background: linear-gradient(135deg, #4aa3ff, #8a7cf6);
}

.qq-link {
  color: #ffffff;
}

.know-more {
  width: fit-content;
  margin: 18px auto 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.94rem;
  font-weight: 900;
}

.profile-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  margin: 20px 0 0;
  padding: 10px 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  font-size: clamp(1rem, 1.4vw, 1.18rem);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.hero-main,
.glass-card,
.ask-form {
  padding: clamp(22px, 4vw, 34px);
}

.glass-card,
.note-item,
.article-card,
.ask-form,
.social-card {
  background: var(--panel-strong);
}

.hero-main {
  position: relative;
  overflow: hidden;
}

.hero-main::before {
  content: "";
  display: block;
  width: 86px;
  height: 6px;
  margin-bottom: 26px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--pink), var(--yellow), var(--cyan));
}

.eyebrow {
  margin: 0 0 10px;
  color: #0d8795;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-actions,
.social-grid,
.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 900;
  cursor: pointer;
}

.button.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--pink), #ff8b5f);
}

.button.secondary {
  color: #107281;
  border-color: rgba(50, 199, 217, 0.32);
  background: rgba(50, 199, 217, 0.1);
}

.button.danger {
  color: #ffd6e7;
  border-color: rgba(255, 111, 174, 0.34);
  background: rgba(255, 111, 174, 0.12);
}

.section {
  padding: clamp(44px, 7vw, 76px) 0;
}

.section-title {
  margin-bottom: 24px;
}

.section-title h2,
.glass-card h2,
.discussion-preview h2 {
  margin: 0;
  font-size: clamp(1.55rem, 3vw, 2.5rem);
  line-height: 1.16;
}

.social-grid {
  margin-top: 0;
}

.social-card {
  min-width: 180px;
  display: grid;
  gap: 3px;
  padding: 16px 18px;
}

.social-card span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.social-card strong {
  overflow-wrap: anywhere;
}

.card-grid,
.two-column,
.ask-layout {
  display: grid;
  gap: 18px;
}

.card-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mini-grid,
.friend-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.mini-card,
.friend-card {
  display: grid;
  gap: 10px;
  align-content: start;
  min-height: 180px;
  padding: 22px;
}

.mini-card h3,
.friend-card strong {
  margin: 0;
  color: var(--ink);
  font-size: 1.35rem;
  line-height: 1.2;
}

.two-column,
.ask-layout {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.ask-stack {
  display: grid;
  gap: 18px;
}

.account-card {
  display: grid;
  gap: 14px;
}

.account-card h2 {
  margin: 0;
  font-size: 1.35rem;
}

.account-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.auth-tabs button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.auth-tabs button.is-active {
  color: #fff;
  border-color: rgba(255, 111, 174, 0.42);
  background: rgba(255, 111, 174, 0.18);
}

.feature-card {
  min-height: 260px;
  display: flex;
  flex-direction: column;
}

.room-card {
  position: relative;
  justify-content: flex-end;
  overflow: hidden;
  color: #fff;
  background-size: cover;
  background-position: center;
}

.room-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--room-overlay);
  z-index: 0;
}

.room-card > * {
  position: relative;
  z-index: 1;
}

.notes-room {
  background-image: url("assets/room-notes.jpg");
}

.articles-room {
  background-image: url("assets/room-articles.jpg");
}

.ask-room {
  background-image: url("assets/room-ask.jpg");
}

.room-card h3 {
  color: #fff;
  text-shadow: 0 8px 22px rgba(0, 0, 0, 0.46);
}

.room-card a {
  color: #fff;
}

.feature-card h3,
.note-item h2,
.article-card h2 {
  margin: 0 0 8px;
  line-height: 1.25;
}

.feature-card a {
  width: fit-content;
  margin-top: auto;
  color: #107281;
  font-weight: 900;
}

.tag {
  width: fit-content;
  margin-bottom: 14px;
  padding: 5px 10px;
  border-radius: 999px;
  color: #77405f;
  background: #ffd6e7;
  font-size: 0.78rem;
  font-weight: 900;
}

.note-list,
.article-list,
.archive-list,
.moments-list {
  display: grid;
  gap: 14px;
}

.note-item,
.archive-item {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 18px;
  padding: 22px;
}

.note-item time,
.article-card time,
.archive-item time,
.moment-card time {
  color: #a54778;
  font-weight: 900;
}

.note-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 38px;
  margin-top: 12px;
  padding: 8px 14px;
  border: 1px solid rgba(50, 199, 217, 0.34);
  border-radius: 8px;
  color: #dffcff;
  background: rgba(50, 199, 217, 0.12);
  font-weight: 900;
}

.article-card {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
}

.archive-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.archive-item h2,
.moment-card h2 {
  margin: 0 0 8px;
  line-height: 1.25;
}

.moment-card {
  position: relative;
  display: grid;
  gap: 16px;
  overflow: hidden;
  min-height: 260px;
  padding: clamp(20px, 4vw, 30px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(32, 36, 58, 0.9), rgba(47, 51, 78, 0.78)),
    var(--moment-bg, none),
    var(--panel);
  background-size: cover;
  background-position: center;
  box-shadow: var(--shadow);
}

.moment-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 12% 18%, rgba(255, 111, 174, 0.2), transparent 25rem);
  pointer-events: none;
}

.moment-head,
.moment-content,
.moment-gallery,
.moment-image {
  position: relative;
  z-index: 1;
}

.moment-head {
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: center;
  gap: 18px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(203, 213, 255, 0.14);
}

.moment-avatar {
  width: 72px;
  height: 72px;
  border: 2px solid rgba(124, 211, 255, 0.26);
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.24);
}

.moment-head strong {
  display: block;
  color: #9eb7e9;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.7rem, 4vw, 2.45rem);
  line-height: 1;
}

.moment-head time {
  display: block;
  margin-top: 8px;
  color: rgba(218, 227, 255, 0.74);
  font-size: clamp(1rem, 2vw, 1.18rem);
}

.moment-head time::before {
  content: "";
  display: inline-block;
  width: 0.72em;
  height: 0.72em;
  margin-right: 8px;
  border: 2px solid currentColor;
  border-radius: 999px;
  vertical-align: -0.06em;
}

.moment-content {
  display: grid;
  gap: 12px;
  max-width: 760px;
}

.moment-content p {
  white-space: pre-wrap;
  color: rgba(255, 255, 255, 0.92);
  font-size: clamp(1.28rem, 2.4vw, 1.9rem);
  font-weight: 800;
  line-height: 1.8;
}

.moment-gallery,
.admin-moment-gallery {
  display: grid;
  gap: 10px;
}

.moment-gallery {
  justify-self: center;
  width: min(100%, 720px);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.moment-gallery[data-count="1"] {
  grid-template-columns: minmax(0, 1fr);
  width: min(100%, 520px);
}

.moment-gallery[data-count="3"] {
  grid-template-columns: 1.15fr 1fr;
}

.moment-gallery[data-count="3"] .moment-image:first-child {
  grid-row: span 2;
}

.admin-moment-gallery {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.moment-image,
.admin-moment-image {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

.moment-image {
  aspect-ratio: 16 / 10;
  max-height: 360px;
}

.admin-moment-image {
  aspect-ratio: 16 / 10;
  max-height: 220px;
}

.resource-board,
.resource-group {
  display: grid;
  gap: 22px;
}

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

.resource-card {
  display: grid;
  gap: 8px;
  padding: 20px;
  transition: transform 180ms ease, border-color 180ms ease;
}

.resource-card:hover,
.resource-card:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(50, 199, 217, 0.38);
  outline: none;
}

.resource-card strong {
  font-size: 1.08rem;
}

.clean-list {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
}

.clean-list strong {
  color: var(--ink);
}

.about-card {
  max-width: 900px;
  margin: 0 auto;
  overflow-wrap: anywhere;
}

.about-card h3 {
  margin-top: 20px;
}

.aside-text {
  color: var(--muted);
}

.inline-button {
  width: fit-content;
  margin-top: 8px;
}

.ask-form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
  font: inherit;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--cyan);
  outline: 3px solid rgba(50, 199, 217, 0.2);
}

select {
  appearance: none;
}

.button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.form-status {
  min-height: 1.7em;
  color: var(--muted);
  font-size: 0.94rem;
}

.discussion-preview {
  align-content: start;
}

.discussion-preview article {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.public-qa-list {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.private-qa-section {
  margin-top: 28px;
}

.public-qa-list article {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.qa-item {
  display: grid;
  gap: 14px;
}

.qa-question,
.qa-answer {
  display: grid;
  gap: 4px;
}

.qa-answer {
  padding-top: 12px;
  border-top: 1px dashed rgba(255, 255, 255, 0.18);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 28px clamp(18px, 4vw, 52px);
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.admin-shell {
  width: min(1120px, calc(100% - 36px));
  margin: 0 auto;
  padding: clamp(48px, 8vw, 92px) 0;
}

.admin-login {
  width: min(560px, 100%);
  margin: 0 auto;
  padding: clamp(24px, 5vw, 40px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.admin-login h1,
.admin-dashboard h1 {
  margin: 0;
  font-size: clamp(2.2rem, 6vw, 4.4rem);
  line-height: 1.08;
}

.admin-dashboard > .section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.admin-theme-toggle {
  flex: 0 0 auto;
}

.admin-tabs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  margin: 24px 0 28px;
  padding-bottom: 6px;
}

.admin-tabs button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 16px;
  color: var(--muted);
  background: var(--panel);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.admin-tabs button.is-active {
  color: #fff;
  border-color: rgba(255, 111, 174, 0.45);
  background: linear-gradient(135deg, rgba(255, 111, 174, 0.28), rgba(50, 199, 217, 0.18));
}

.admin-view[hidden] {
  display: none;
}

.admin-form {
  margin-top: 24px;
}

.admin-section {
  width: 100%;
}

.admin-list {
  display: grid;
  gap: 14px;
}

.admin-row {
  display: grid;
  gap: 10px;
}

.admin-row-head,
.admin-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-row-head > div {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-row-head time {
  color: var(--muted);
  font-size: 0.86rem;
}

.admin-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  color: #ffd6e7;
  background: rgba(255, 111, 174, 0.14);
  font-size: 0.78rem;
  font-weight: 900;
}

.question-text {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.site-footer a {
  color: var(--ink);
  font-weight: 900;
}

@media (max-width: 1120px) {
  .site-header {
    gap: 10px;
  }

  .brand {
    flex: 1 1 auto;
  }

  .theme-toggle {
    order: 2;
  }

  .nav-toggle {
    display: block;
    order: 3;
  }

  .site-nav {
    position: absolute;
    top: calc(100% + 1px);
    left: 18px;
    right: 18px;
    display: none;
    grid-template-columns: 1fr;
    gap: 10px;
    align-items: stretch;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-strong);
    background: color-mix(in srgb, var(--panel-strong) 92%, #0d1020);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
  }

  .site-nav.is-open {
    display: grid;
  }

  .site-nav a {
    display: block;
    min-height: 52px;
    padding: 13px 16px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    font-size: 1.02rem;
  }

  .site-nav .nav-extra {
    display: block;
  }

  .home-hero,
  .card-grid,
  .two-column,
  .ask-layout,
  .mini-grid,
  .friend-grid {
    grid-template-columns: 1fr;
  }

  .home-hero {
    min-height: auto;
  }

  .hero-profile {
    min-height: auto;
  }

  .profile-head {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .avatar-shell {
    width: min(42vw, 150px);
    height: min(42vw, 150px);
  }

  .profile-stats {
    max-width: 520px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
  }

  .about-hero {
    min-height: 360px;
    padding: 28px;
    background-position: 58% center;
  }

  .note-item,
  .archive-item {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .moment-gallery,
  .moment-gallery[data-count="3"] {
    grid-auto-flow: column;
    grid-auto-columns: minmax(220px, 42vw);
    grid-template-columns: none;
    justify-self: stretch;
    width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: inline proximity;
    padding-bottom: 8px;
  }

  .moment-gallery[data-count="3"] .moment-image:first-child {
    grid-row: auto;
  }

  .moment-gallery[data-count="1"] {
    grid-template-columns: minmax(0, 1fr);
    grid-auto-flow: row;
    width: min(100%, 520px);
    overflow-x: visible;
    padding-bottom: 0;
  }

  .moment-image {
    scroll-snap-align: start;
  }
}

@media (max-width: 560px) {
  .site-header {
    padding: 12px 14px;
  }

  .brand span:last-child {
    max-width: 210px;
  }

  .home-hero,
  .page-main,
  .section {
    width: min(100% - 28px, 1120px);
  }

  .hero-profile {
    padding: 22px;
  }

  .hero-profile h1,
  .profile-text h1 {
    font-size: clamp(2.45rem, 16vw, 4rem);
  }

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

  .profile-stats strong {
    font-size: clamp(1.55rem, 9vw, 2.4rem);
  }

  .about-hero p:not(.eyebrow) {
    font-size: clamp(1.45rem, 9vw, 2.4rem);
  }

  .moment-card {
    padding: 20px;
  }

  .moment-head {
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 12px;
    padding-bottom: 18px;
  }

  .moment-avatar {
    width: 52px;
    height: 52px;
  }

  .moment-head strong {
    font-size: clamp(1.45rem, 10vw, 2.2rem);
    overflow-wrap: anywhere;
  }

  .moment-head time {
    font-size: 0.98rem;
  }

  .moment-content p {
    font-size: 1.12rem;
    line-height: 1.75;
  }

  .about-card,
  .glass-card,
  .note-item,
  .article-card,
  .ask-form,
  .social-card {
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.32);
  }

  .hero-actions .button,
  .social-card {
    width: 100%;
  }

  .icon-links a {
    width: 54px;
    height: 54px;
    border-radius: 12px;
  }

  .article-card {
    display: grid;
  }

  .resource-grid {
    grid-template-columns: 1fr;
  }

  .admin-row-head,
  .admin-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .site-footer {
    flex-direction: column;
  }
}
