:root {
  color-scheme: light;
  --ink: #273033;
  --muted: #687579;
  --paper: #fffaf2;
  --panel: #ffffff;
  --line: rgba(39, 48, 51, 0.12);
  --mint: #8fd2c8;
  --coral: #e98f73;
  --gold: #f2c36b;
  --berry: #8a6aa8;
  --shadow: 0 18px 60px rgba(38, 53, 61, 0.12);
  --topbar-bg: rgba(246, 251, 248, 0.82);
  --topnav-bg: rgba(255, 255, 255, 0.74);
  --glass-bg: rgba(255, 255, 255, 0.72);
  --surface-bg: rgba(255, 253, 249, 0.78);
  --surface-soft-bg: rgba(255, 255, 255, 0.72);
  --text-soft: #3f4e52;
  --body-bg:
    radial-gradient(circle at 18% 14%, rgba(143, 210, 200, 0.38), transparent 25rem),
    radial-gradient(circle at 82% 10%, rgba(242, 195, 107, 0.32), transparent 22rem),
    linear-gradient(180deg, #f6fbf8 0%, var(--paper) 44%, #f8f1ea 100%);
  font-family:
    "Inter", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e8e4dd;
  --muted: #9a978f;
  --paper: #1a1d21;
  --panel: #21252b;
  --line: rgba(200, 195, 188, 0.14);
  --mint: #6ab8af;
  --coral: #d47a5e;
  --gold: #d4a84b;
  --berry: #9b7ec4;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
  --topbar-bg: rgba(26, 29, 33, 0.86);
  --topnav-bg: rgba(33, 37, 43, 0.82);
  --glass-bg: rgba(33, 37, 43, 0.9);
  --surface-bg: rgba(26, 29, 33, 0.82);
  --surface-soft-bg: rgba(33, 37, 43, 0.74);
  --text-soft: #b0aaa0;
  --body-bg:
    radial-gradient(circle at 18% 14%, rgba(106, 184, 175, 0.18), transparent 25rem),
    radial-gradient(circle at 82% 10%, rgba(212, 168, 75, 0.15), transparent 22rem),
    linear-gradient(180deg, #1a1d21 0%, #1e2228 44%, #1d1f24 100%);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background: var(--body-bg);
}

.home-page {
  display: grid;
  grid-template-rows: auto 1fr auto;
}

button,
input,
select,
textarea {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  width: min(1120px, calc(100% - 32px));
  min-height: 64px;
  margin: 0 auto;
  padding: 10px 0;
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  background: var(--topbar-bg);
  backdrop-filter: blur(18px);
}

.brand {
  color: var(--ink);
  font-size: 1.1rem;
  font-weight: 950;
  text-decoration: none;
  white-space: nowrap;
}

.topnav {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  background: var(--topnav-bg);
  box-shadow: 0 10px 28px rgba(38, 53, 61, 0.08);
}

.topnav a {
  min-height: 38px;
  border-radius: 7px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  color: #46565a;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.topnav a:hover,
.topnav a.active {
  color: var(--ink);
  background: #fff8ed;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 4px 0 56px;
}

.home-shell {
  min-height: 0;
  padding: 0 0 34px;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-content: stretch;
}

.page-shell {
  padding-top: 34px;
}

.page-hero {
  padding: 42px 0 28px;
}

.page-hero h1 {
  max-width: 760px;
}

/* 法律条款页面（隐私政策 / 用户协议） */
.legal-content {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 0 60px;
  line-height: 1.85;
  color: var(--ink);
}

.legal-content h2 {
  margin-top: 36px;
  margin-bottom: 14px;
  font-size: 1.22rem;
  font-weight: 700;
  color: var(--ink);
}

.legal-content h2:first-child {
  margin-top: 0;
}

.legal-content p {
  margin: 0 0 14px;
  color: var(--muted);
}

.legal-content ul {
  margin: 0 0 14px;
  padding-left: 22px;
  color: var(--muted);
}

.legal-content li {
  margin-bottom: 8px;
}

.legal-content li:last-child {
  margin-bottom: 0;
}

.legal-content strong {
  color: var(--ink);
}

.home-gateway {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.gateway-link {
  min-height: 132px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  display: grid;
  align-content: center;
  gap: 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
  text-decoration: none;
}

.gateway-link span {
  color: var(--coral);
  font-weight: 900;
}

.gateway-link strong {
  font-size: clamp(1.15rem, 2.4vw, 1.6rem);
  line-height: 1.25;
}

.gateway-link:hover {
  transform: translateY(-1px);
}

.hero {
  min-height: min(700px, calc(100vh - 48px));
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(300px, 1.1fr);
  gap: 32px;
  align-items: center;
  padding: 36px 0 24px;
}

.home-shell .hero {
  min-height: 0;
  padding: clamp(24px, 5vh, 56px) 0;
}

.hero-art {
  position: relative;
  min-height: 420px;
  display: grid;
  place-items: center;
}

.hero-asset {
  width: min(86vw, 530px);
  max-height: 560px;
  object-fit: contain;
  filter: drop-shadow(0 28px 54px rgba(83, 96, 112, 0.16));
}

.planet {
  position: relative;
  width: min(74vw, 360px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.92), transparent 0 18%),
    radial-gradient(circle at 66% 70%, rgba(233, 143, 115, 0.32), transparent 0 24%),
    linear-gradient(145deg, #f4d9b6, #91d1c8 52%, #8a6aa8);
  box-shadow:
    inset -22px -26px 58px rgba(62, 52, 88, 0.18),
    0 34px 90px rgba(83, 96, 112, 0.22);
}

.planet::before,
.planet::after {
  content: "";
  position: absolute;
  top: 38%;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #2e3335;
  box-shadow: 0 3px 0 rgba(255, 255, 255, 0.35) inset;
}

.planet::before {
  left: 34%;
}

.planet::after {
  right: 34%;
}

.planet-ring {
  position: absolute;
  inset: 44% -26%;
  border: 18px solid rgba(255, 255, 255, 0.72);
  border-left-color: rgba(242, 195, 107, 0.64);
  border-right-color: rgba(233, 143, 115, 0.55);
  border-radius: 50%;
  rotate: -12deg;
  box-shadow: 0 10px 26px rgba(72, 65, 87, 0.12);
}

.planet-face {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% 0;
  color: rgba(46, 51, 53, 0.78);
  font-size: 22px;
  letter-spacing: 8px;
}

.star {
  position: absolute;
  width: 14px;
  aspect-ratio: 1;
  background: var(--gold);
  clip-path: polygon(50% 0, 62% 36%, 100% 50%, 62% 64%, 50% 100%, 38% 64%, 0 50%, 38% 36%);
  animation: twinkle 2.8s ease-in-out infinite;
}

.star-one {
  left: 8%;
  top: 22%;
}

.star-two {
  right: 11%;
  top: 18%;
  width: 20px;
  animation-delay: 0.4s;
}

.star-three {
  right: 22%;
  bottom: 16%;
  background: var(--coral);
  animation-delay: 0.9s;
}

.hero-copy {
  padding: 24px 0;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--coral);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 18px;
  font-size: clamp(3.2rem, 12vw, 7.2rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1.08;
}

.lede {
  max-width: 620px;
  margin-bottom: 28px;
  color: #4f5c60;
  font-size: clamp(1.05rem, 2vw, 1.28rem);
  line-height: 1.85;
}

.hero-actions,
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button,
.filter {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 44px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.button:hover,
.filter:hover {
  transform: translateY(-1px);
  border-color: rgba(39, 48, 51, 0.28);
}

.primary {
  color: #172326;
  border-color: transparent;
  background: linear-gradient(135deg, var(--gold), var(--coral));
  font-weight: 800;
}

.ghost {
  font-weight: 700;
}

.subtle {
  color: var(--muted);
  font-weight: 800;
  background: rgba(255, 255, 255, 0.48);
}

.stats,
.toolbar,
.wall-notice,
.planet-map,
.resident-page,
.single-resident,
.add-memory,
.submission-form,
.submission-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--glass-bg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
}

.wall-notice {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
}

.stats article,
.wall-notice article {
  padding: 22px;
  border-right: 1px solid var(--line);
}

.stats article:last-child,
.wall-notice article:last-child {
  border-right: 0;
}

.stats span {
  display: block;
  margin-bottom: 4px;
  font-size: 2rem;
  font-weight: 900;
}

.stats p {
  margin: 0;
  color: var(--muted);
}

.guardian-panel {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 0.62fr);
  gap: 18px;
  align-items: center;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.guardian-panel h2 {
  margin-bottom: 8px;
  font-size: clamp(1.55rem, 3vw, 2.15rem);
}

.guardian-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.guardian-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.guardian-list li {
  border: 1px solid rgba(242, 195, 107, 0.42);
  border-radius: 999px;
  padding: 8px 12px;
  display: grid;
  gap: 2px;
  color: #6f5630;
  background: rgba(242, 195, 107, 0.16);
  font-size: 0.88rem;
  font-weight: 900;
}

.guardian-list span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.about-shell {
  display: grid;
  gap: 24px;
}

.about-hero {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 42px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 32px;
  align-items: center;
  background:
    radial-gradient(circle at 86% 20%, rgba(242, 195, 107, 0.2), transparent 0 28%),
    rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.about-hero h1 {
  max-width: 780px;
}

.about-orbit {
  position: relative;
  width: min(100%, 250px);
  aspect-ratio: 1;
  justify-self: center;
  border: 1px dashed rgba(138, 106, 168, 0.36);
  border-radius: 50%;
}

.about-planet {
  position: absolute;
  inset: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #172326;
  background: linear-gradient(135deg, var(--mint), var(--gold));
  box-shadow: 0 22px 52px rgba(38, 53, 61, 0.16);
  font-weight: 950;
}

.about-moon,
.about-star {
  position: absolute;
  border-radius: 50%;
}

.about-moon {
  top: 34px;
  right: 34px;
  width: 28px;
  aspect-ratio: 1;
  background: var(--coral);
  box-shadow: 0 0 18px rgba(233, 143, 115, 0.54);
}

.about-star {
  width: 9px;
  aspect-ratio: 1;
  background: var(--gold);
  box-shadow: 0 0 14px rgba(242, 195, 107, 0.72);
}

.about-star-one {
  left: 34px;
  top: 66px;
}

.about-star-two {
  right: 74px;
  bottom: 34px;
}

.about-grid,
.about-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.about-card,
.about-section,
.about-steps article,
.faq-list details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.about-card,
.about-steps article {
  padding: 22px;
}

.about-card h2,
.about-section h2 {
  font-size: clamp(1.45rem, 3vw, 2.1rem);
}

.about-card p,
.about-steps p,
.faq-list p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.78;
}

.about-section {
  padding: 26px;
}

.about-steps {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 18px;
}

.about-steps span {
  display: inline-grid;
  width: 40px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  color: #172326;
  background: var(--gold);
  font-weight: 950;
}

.about-steps h3 {
  margin: 16px 0 0;
  font-size: 1.08rem;
}

.faq-list {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}

.faq-list details {
  padding: 18px 20px;
}

.faq-list summary {
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
}

.about-guardian {
  margin-top: 0;
}

.site-footer {
  width: min(1120px, calc(100% - 32px));
  min-height: 56px;
  margin: auto auto 0;
  padding: 14px 0 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  align-items: center;
  justify-content: center;
  color: rgba(39, 48, 51, 0.58);
  font-size: 0.86rem;
}

.footer-copy {
  margin: 0;
  font-size: 0.82rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  align-items: center;
  justify-content: center;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.footer-sep {
  color: rgba(39, 48, 51, 0.3);
  user-select: none;
}

.gongan-icon {
  display: inline-block;
  vertical-align: -3px;
  margin-right: 2px;
  border-radius: 2px;
}

.wall-notice span {
  display: block;
  margin-bottom: 8px;
  color: var(--coral);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.wall-notice strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.18rem;
}

.wall-notice p {
  margin: 0;
  color: #4d5b5f;
  line-height: 1.7;
}

.toolbar {
  margin: 0 0 22px;
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 18px;
  align-items: end;
}

.search-field,
.memory-form label,
.submission-form label {
  display: grid;
  gap: 8px;
}

.search-field span,
.memory-form span,
.submission-form span {
  color: #526064;
  font-size: 0.9rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdf9;
  color: var(--ink);
  outline: none;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

input,
select {
  min-height: 46px;
  padding: 0 14px;
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23687579' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

select:hover {
  border-color: var(--mint);
  background-color: #f8fffc;
}

select:focus {
  border-color: var(--coral);
  box-shadow: 0 0 0 4px rgba(233, 143, 115, 0.16);
  background-color: #fff;
}

select option {
  padding: 10px 14px;
  background: #fff;
  color: var(--ink);
  font-size: 0.93rem;
}

select option:checked {
  background: var(--mint);
  color: #1a3d38;
  font-weight: 600;
}

select optgroup {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 0;
}

/* ---- 自定义下拉组件 ---- */
.custom-select {
  position: relative;
  width: 100%;
}

.custom-select-trigger {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdf9;
  color: var(--ink);
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  text-align: left;
}

.custom-select-trigger:hover {
  border-color: var(--mint);
  background-color: #f8fffc;
}

.custom-select-trigger.open {
  border-color: var(--coral);
  box-shadow: 0 0 0 4px rgba(233, 143, 115, 0.16);
  background-color: #fff;
  border-radius: 10px 10px 0 0;
}

.custom-select-trigger.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: rgba(0, 0, 0, 0.03);
}

.custom-select-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-select-arrow {
  flex-shrink: 0;
  width: 12px;
  height: 8px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23687579' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E") center/contain no-repeat;
  transition: transform 0.2s;
}

.custom-select-trigger.open .custom-select-arrow {
  transform: rotate(180deg);
}

.custom-select-panel {
  position: absolute;
  inset: 100% 0 auto 0;
  z-index: 100;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--coral);
  border-top: none;
  border-radius: 0 0 10px 10px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(38, 53, 61, 0.15);
  display: none;
  padding: 4px 0;
}

.custom-select-panel.open {
  display: block;
}

.custom-select-option {
  padding: 10px 16px;
  font-size: 0.93rem;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  user-select: none;
}

.custom-select-option:hover {
  background: rgba(143, 210, 200, 0.15);
  color: #1a3d38;
}

.custom-select-option.active {
  background: var(--mint);
  color: #1a3d38;
  font-weight: 600;
}

.custom-select-option:first-child {
  color: var(--muted);
  font-style: italic;
}

input[type="color"] {
  min-height: 44px;
  padding: 4px;
}

textarea {
  min-height: 118px;
  resize: vertical;
  padding: 12px 14px;
}

input:focus,
textarea:focus {
  border-color: var(--coral);
  box-shadow: 0 0 0 4px rgba(233, 143, 115, 0.18);
}

.filter.active {
  background: #243034;
  color: #fff;
}

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

.planet-map {
  margin: 18px 0 42px;
  padding: 0;
}

.standalone-map {
  margin-top: 0;
}

.planet-showcase {
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.three-planet-stage {
  position: relative;
  min-height: min(820px, calc(100vh - 220px));
  border: 1px solid rgba(39, 48, 51, 0.1);
  border-radius: 8px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 22%, rgba(255, 255, 255, 0.9) 0 1px, transparent 2px),
    radial-gradient(circle at 78% 18%, rgba(242, 195, 107, 0.78) 0 1px, transparent 2px),
    radial-gradient(circle at 68% 76%, rgba(143, 210, 200, 0.72) 0 1px, transparent 2px),
    radial-gradient(circle at 88% 64%, rgba(255, 255, 255, 0.7) 0 1px, transparent 2px),
    radial-gradient(circle at 30% 78%, rgba(143, 210, 200, 0.65) 0 1px, transparent 2px),
    radial-gradient(circle at 50% 50%, rgba(233, 143, 115, 0.2), transparent 42%),
    linear-gradient(145deg, #1d2b34, #33404d 48%, #3d3551);
}

.three-planet-canvas {
  width: min(86vw, 760px);
  height: min(86vw, 760px);
  display: block;
  cursor: grab;
  touch-action: none;
  user-select: none;
  filter: drop-shadow(0 34px 58px rgba(15, 23, 31, 0.28));
}

.three-planet-canvas.dragging {
  cursor: grabbing;
}

.three-planet-fallback {
  color: rgba(255, 255, 255, 0.86);
  font-weight: 900;
}

/* ---- 星球地图区域浮层 ---- */
.planet-tooltip {
  position: absolute;
  z-index: 10;
  padding: 6px 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 900;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 6px 22px rgba(38, 53, 61, 0.18);
  backdrop-filter: blur(8px);
  transition: opacity 0.12s ease;
}

[data-theme="dark"] .planet-tooltip {
  background: rgba(33, 37, 43, 0.94);
  color: #e8e4dd;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.35);
}

/* ---- 地图页区域居民面板 ---- */
.map-region-panel {
  margin: 12px 0 42px;
  padding: 28px 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
}

[data-theme="dark"] .map-region-panel {
  background: rgba(33, 37, 43, 0.78);
}

.map-region-header {
  margin-bottom: 22px;
}

.map-region-header .eyebrow {
  margin-bottom: 6px;
}

.map-region-header h2 {
  margin: 0 0 6px;
  font-size: 1.4rem;
}

.map-region-header .lede {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.map-residents-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.archive {
  margin: 42px 0;
}

.map-residents {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  align-content: start;
}

.resident-chip {
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  gap: 12px;
  align-items: center;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  text-align: left;
  font-weight: 800;
}

.mini-avatar {
  width: 34px;
  aspect-ratio: 1;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(35, 44, 48, 0.14);
}

.resident-page {
  margin: 0 0 42px;
  padding: 24px;
}

.resident-page[hidden] {
  display: none;
}

.resident-hero {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 26px;
  align-items: center;
}

.back-link {
  grid-column: 1 / -1;
  width: fit-content;
  color: #405056;
  font-weight: 800;
  text-decoration: none;
}

.back-link:hover {
  color: var(--coral);
}

.resident-portrait {
  display: grid;
  place-items: center;
  min-height: 180px;
  border-radius: 8px;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.9), transparent 0 42%),
    linear-gradient(135deg, rgba(143, 210, 200, 0.22), rgba(242, 195, 107, 0.2));
}

.avatar.large {
  width: 118px;
}

.resident-copy h2 {
  margin-bottom: 10px;
}

.resident-subtitle {
  color: var(--muted);
}

.star-calendar-pill {
  width: fit-content;
  margin: 12px 0 0;
  border: 1px solid rgba(242, 195, 107, 0.42);
  border-radius: 999px;
  padding: 8px 12px;
  color: #6f5630;
  background: rgba(242, 195, 107, 0.16);
  font-size: 0.88rem;
  font-weight: 900;
}

.resident-notes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.resident-notes article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 253, 249, 0.76);
}

.resident-notes span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.resident-notes strong {
  font-size: 1.15rem;
}

.single-resident {
  padding: 26px;
  backdrop-filter: none;
}

.single-hero {
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(0, 1.28fr);
  gap: 34px;
  align-items: center;
}

.single-hero .back-link {
  grid-column: 1 / -1;
}

.single-portrait {
  min-height: 360px;
  border: 1px solid rgba(39, 48, 51, 0.1);
  border-radius: 8px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 48%, rgba(255, 255, 255, 0.92), transparent 0 36%),
    radial-gradient(circle at 28% 22%, rgba(242, 195, 107, 0.28), transparent 0 28%),
    linear-gradient(135deg, rgba(143, 210, 200, 0.24), rgba(138, 106, 168, 0.12));
}

.memorial-avatar {
  width: min(48vw, 190px);
  border-width: 10px;
  box-shadow: 0 24px 70px rgba(35, 44, 48, 0.18);
}

.single-copy h1 {
  margin-bottom: 14px;
  font-size: clamp(3rem, 9vw, 6rem);
}

.resident-loader {
  min-height: min(56vh, 520px);
  display: grid;
  place-items: center;
}

.resident-loader-card {
  width: min(100%, 460px);
  border: 1px solid rgba(39, 48, 51, 0.1);
  border-radius: 18px;
  padding: 34px;
  text-align: center;
  background:
    radial-gradient(circle at 24% 18%, rgba(242, 195, 107, 0.25), transparent 0 28%),
    radial-gradient(circle at 82% 22%, rgba(143, 210, 200, 0.28), transparent 0 24%),
    rgba(255, 255, 255, 0.72);
  box-shadow: 0 22px 70px rgba(35, 44, 48, 0.12);
}

.resident-loader-face {
  width: 86px;
  height: 86px;
  margin: 0 auto 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff6df;
  box-shadow: inset 0 -8px 0 rgba(242, 195, 107, 0.2), 0 12px 32px rgba(35, 44, 48, 0.12);
  font-size: 2.7rem;
  animation: resident-loader-bob 1.8s ease-in-out infinite;
}

.resident-loader-text {
  min-height: 1.8em;
  margin: 10px 0 20px;
  color: var(--ink);
  font-weight: 900;
  font-size: clamp(1.2rem, 3vw, 1.55rem);
}

.resident-loader-text::after {
  content: "鼠鼠正在起床……";
  animation: resident-loader-copy 6s steps(1, end) infinite;
}

.resident-loader-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(39, 48, 51, 0.08);
}

.resident-loader-track span {
  display: block;
  height: 100%;
  width: 42%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f2c36b, #8fd2c8, #e98f73);
  box-shadow: 0 0 18px rgba(143, 210, 200, 0.45);
  animation: resident-loader-progress 1.45s ease-in-out infinite;
}

.single-memory {
  max-width: 680px;
  margin: 24px 0;
  color: var(--text-soft);
  font-size: clamp(1.18rem, 2.4vw, 1.45rem);
  line-height: 1.9;
}

.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.share-status {
  margin-top: 14px;
}

.memorial-note,
.share-preview {
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-bg);
}

.memorial-note {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  overflow: hidden;
}

.memorial-note article {
  min-width: 0;
  padding: 18px;
  border-right: 1px solid var(--line);
}

.memorial-note article:last-child {
  border-right: 0;
}

.memorial-note span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.memorial-note strong {
  display: block;
  max-width: 100%;
  font-size: 1.12rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.share-preview {
  padding: 22px;
}

.world-panel,
.ritual-panel,
.memory-board,
.time-capsule-panel {
  margin-top: 22px;
  border: 1px solid rgba(39, 48, 51, 0.1);
  border-radius: 8px;
  padding: 22px;
  background: var(--surface-bg);
}

.world-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 22px;
  align-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 86% 38%, rgba(138, 106, 168, 0.16), transparent 0 30%),
    linear-gradient(135deg, var(--surface-bg), rgba(242, 195, 107, 0.12));
}

.world-panel h2 {
  font-size: clamp(1.55rem, 3vw, 2.2rem);
}

.world-panel p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.8;
}

.world-orbit {
  position: relative;
  width: 130px;
  aspect-ratio: 1;
  border: 1px dashed rgba(138, 106, 168, 0.34);
  border-radius: 50%;
}

.world-orbit::before {
  content: "";
  position: absolute;
  inset: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--mint), var(--gold));
  box-shadow: 0 14px 34px rgba(38, 53, 61, 0.14);
}

.world-orbit span {
  position: absolute;
  right: 12px;
  top: 18px;
  width: 18px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 16px rgba(233, 143, 115, 0.58);
}

.ritual-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 82% 26%, rgba(242, 195, 107, 0.2), transparent 0 26%),
    linear-gradient(135deg, var(--surface-bg), rgba(143, 210, 200, 0.14));
}

.ritual-panel h2,
.memory-board h2,
.time-capsule-panel h2 {
  font-size: clamp(1.55rem, 3vw, 2.2rem);
}

.ritual-panel p,
.memory-board-head p,
.time-capsule-panel p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.ritual-stars {
  min-width: 210px;
  min-height: 96px;
  position: relative;
}

.ritual-stars span {
  position: absolute;
  width: 18px;
  aspect-ratio: 1;
  background: var(--gold);
  clip-path: polygon(50% 0, 62% 36%, 100% 50%, 62% 64%, 50% 100%, 38% 64%, 0 50%, 38% 36%);
  filter: drop-shadow(0 0 12px rgba(242, 195, 107, 0.75));
}

.ritual-stars span:nth-child(1) {
  left: 12px;
  top: 42px;
}

.ritual-stars span:nth-child(2) {
  left: 60px;
  top: 12px;
  width: 24px;
  animation-delay: 0.2s;
}

.ritual-stars span:nth-child(3) {
  left: 112px;
  top: 52px;
  width: 16px;
  animation-delay: 0.45s;
}

.ritual-stars span:nth-child(4) {
  left: 154px;
  top: 22px;
  width: 22px;
  animation-delay: 0.8s;
}

.ritual-stars span:nth-child(5) {
  left: 188px;
  top: 66px;
  width: 14px;
  animation-delay: 1.1s;
}

.ritual-panel .form-status {
  grid-column: 1 / -1;
}

.memory-board-head {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 18px;
}

.memory-notes-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.memory-note-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface-soft-bg);
}

.memory-note-card p {
  margin: 0 0 12px;
  color: var(--text-soft);
  line-height: 1.8;
}

.memory-note-card span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.note-form,
.capsule-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.note-form label,
.capsule-form label {
  display: grid;
  gap: 8px;
}

.note-form span,
.capsule-form span {
  color: #526064;
  font-size: 0.9rem;
  font-weight: 800;
}

.time-capsule-panel {
  display: grid;
  gap: 18px;
}

.share-preview h2 {
  font-size: clamp(1.55rem, 3vw, 2.2rem);
}

.share-preview pre {
  margin: 18px 0 0;
  border: 1px dashed rgba(39, 48, 51, 0.2);
  border-radius: 8px;
  padding: 18px;
  overflow-x: auto;
  white-space: pre-wrap;
  color: var(--text-soft);
  background: var(--panel);
  font: inherit;
  line-height: 1.8;
}

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

/* ---- 纪念星河 ---- */
.wall-hero {
  position: relative;
  overflow: hidden;
  padding-bottom: 18px;
}

.wall-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(1px 1px at 10% 18%, rgba(255, 255, 255, 0.9), transparent),
    radial-gradient(1px 1px at 22% 8%, rgba(242, 195, 107, 0.8), transparent),
    radial-gradient(1.5px 1.5px at 38% 28%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1px 1px at 52% 12%, rgba(143, 210, 200, 0.8), transparent),
    radial-gradient(1.5px 1.5px at 64% 22%, rgba(255, 255, 255, 0.85), transparent),
    radial-gradient(1px 1px at 78% 6%, rgba(242, 195, 107, 0.75), transparent),
    radial-gradient(1.5px 1.5px at 88% 20%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1px 1px at 15% 38%, rgba(143, 210, 200, 0.7), transparent),
    radial-gradient(1.5px 1.5px at 45% 36%, rgba(255, 255, 255, 0.65), transparent),
    radial-gradient(1px 1px at 70% 32%, rgba(242, 195, 107, 0.7), transparent),
    radial-gradient(1.5px 1.5px at 92% 38%, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1px 1px at 28% 48%, rgba(255, 255, 255, 0.55), transparent),
    radial-gradient(1.5px 1.5px at 56% 44%, rgba(143, 210, 200, 0.6), transparent),
    radial-gradient(1px 1px at 82% 48%, rgba(255, 255, 255, 0.5), transparent);
  pointer-events: none;
  animation: wall-stars-twinkle 4s ease-in-out infinite alternate;
}

@keyframes wall-stars-twinkle {
  0% {
    opacity: 0.55;
  }

  100% {
    opacity: 1;
  }
}

[data-theme="dark"] .wall-hero::before {
  background:
    radial-gradient(1px 1px at 10% 18%, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1px 1px at 22% 8%, rgba(242, 195, 107, 0.5), transparent),
    radial-gradient(1.5px 1.5px at 38% 28%, rgba(255, 255, 255, 0.45), transparent),
    radial-gradient(1px 1px at 52% 12%, rgba(143, 210, 200, 0.5), transparent),
    radial-gradient(1.5px 1.5px at 64% 22%, rgba(255, 255, 255, 0.55), transparent),
    radial-gradient(1px 1px at 78% 6%, rgba(242, 195, 107, 0.45), transparent),
    radial-gradient(1.5px 1.5px at 88% 20%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1px 1px at 15% 38%, rgba(143, 210, 200, 0.45), transparent),
    radial-gradient(1.5px 1.5px at 45% 36%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1px 1px at 70% 32%, rgba(242, 195, 107, 0.45), transparent),
    radial-gradient(1.5px 1.5px at 92% 38%, rgba(255, 255, 255, 0.35), transparent),
    radial-gradient(1px 1px at 28% 48%, rgba(255, 255, 255, 0.35), transparent),
    radial-gradient(1.5px 1.5px at 56% 44%, rgba(143, 210, 200, 0.4), transparent),
    radial-gradient(1px 1px at 82% 48%, rgba(255, 255, 255, 0.3), transparent);
}

/* 星河统计条 */
.wall-stats-bar {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-top: 18px;
  font-size: 0.95rem;
  color: var(--muted);
}

.wall-stats-bar strong {
  color: var(--ink);
  font-size: 1.15rem;
}

.wall-stats-divider {
  color: var(--line);
  font-weight: 300;
}

/* 区域筛选行 */
.wall-section-head {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
  justify-content: space-between;
}

.wall-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.wall-section {
  margin-top: 42px;
}

.wall-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.card,
.wall-card {
  position: relative;
  overflow: hidden;
  min-height: 280px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  box-shadow: 0 12px 36px rgba(38, 53, 61, 0.08);
}

.wall-card {
  gap: 0;
  opacity: 0;
  transform: translateY(28px);
  animation: wall-card-enter 0.55s ease forwards;
}

.wall-card:nth-child(1) {
  animation-delay: 0.05s;
}

.wall-card:nth-child(2) {
  animation-delay: 0.10s;
}

.wall-card:nth-child(3) {
  animation-delay: 0.15s;
}

.wall-card:nth-child(4) {
  animation-delay: 0.18s;
}

.wall-card:nth-child(5) {
  animation-delay: 0.21s;
}

.wall-card:nth-child(6) {
  animation-delay: 0.24s;
}

.wall-card:nth-child(7) {
  animation-delay: 0.27s;
}

.wall-card:nth-child(8) {
  animation-delay: 0.30s;
}

.wall-card:nth-child(9) {
  animation-delay: 0.33s;
}

.wall-card:nth-child(10) {
  animation-delay: 0.36s;
}

.wall-card:nth-child(11) {
  animation-delay: 0.39s;
}

.wall-card:nth-child(12) {
  animation-delay: 0.42s;
}

@keyframes wall-card-enter {
  from {
    opacity: 0;
    transform: translateY(28px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.wall-card-glow {
  position: absolute;
  inset: -80px -80px auto auto;
  width: 180px;
  aspect-ratio: 1;
  border-radius: 50%;
  opacity: 0.18;
  filter: blur(8px);
}

.card-top {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
}

.avatar {
  width: 64px;
  aspect-ratio: 1;
  border: 4px solid rgba(255, 255, 255, 0.88);
  border-radius: 50%;
  flex: 0 0 auto;
  box-shadow: 0 8px 18px rgba(35, 44, 48, 0.15);
}

.card h3 {
  margin: 0 0 4px;
  font-size: 1.35rem;
}

.card small {
  color: var(--muted);
}

.wall-owner {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.tags li {
  border-radius: 999px;
  padding: 5px 10px;
  background: #f4eee5;
  color: #5b5250;
  font-size: 0.82rem;
  font-weight: 700;
}

.memory {
  color: #4d5b5f;
  line-height: 1.75;
}

.card-actions {
  margin-top: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.card-actions .button {
  width: 100%;
  padding: 0 10px;
}

.card-actions .button:first-child {
  grid-column: 1 / -1;
}

.danger {
  color: #8f3b2f;
}

.danger:hover {
  border-color: rgba(143, 59, 47, 0.32);
  background: #fff4ef;
}

.wall-actions {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.wall-actions span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.light-button[aria-pressed="true"] {
  color: #172326;
  border-color: transparent;
  background: linear-gradient(135deg, var(--gold), var(--mint));
}

.wall-card.lit {
  border-color: rgba(242, 195, 107, 0.72);
  box-shadow: 0 18px 48px rgba(242, 195, 107, 0.18);
}

.add-memory {
  margin-top: 44px;
  padding: 24px;
}

.submit-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1fr);
  gap: 22px;
  align-items: start;
}

.submission-form {
  padding: 24px;
}

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

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

.full-field {
  grid-column: 1 / -1;
}

.memory-form label:last-of-type,
.form-actions {
  grid-column: 1 / -1;
}

.form-status {
  grid-column: 1 / -1;
  margin: 0;
  border: 1px dashed rgba(39, 48, 51, 0.2);
  border-radius: 8px;
  padding: 12px 14px;
  color: #4d5b5f;
  background: rgba(255, 253, 249, 0.78);
  line-height: 1.7;
}

.form-status.success {
  border-color: var(--mint);
  color: #2d6b63;
  background: rgba(143, 210, 200, 0.14);
}

.form-status.error {
  border-color: var(--coral);
  color: #8b3a2a;
  background: rgba(233, 143, 115, 0.12);
}

.consent-check {
  margin: 10px 0 0;
  border: 1px dashed rgba(39, 48, 51, 0.2);
  border-radius: 8px;
  padding: 10px 14px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  background: rgba(255, 253, 249, 0.78);
}

.consent-check input {
  width: 18px;
  min-height: 18px;
  margin: 2px 0 0;
}

.consent-check span {
  line-height: 1.7;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.form-actions .button {
  flex: 1 1 190px;
}

.admin-topbar {
  justify-content: space-between;
}

.admin-shell {
  max-width: 1040px;
}

.admin-login-panel {
  max-width: 760px;
}

.admin-toolbar {
  grid-template-columns: minmax(220px, 1fr) auto;
}

.admin-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-submissions {
  margin-top: 18px;
  display: grid;
  gap: 18px;
}

.admin-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
}

.admin-card-head {
  display: flex;
  gap: 16px;
  align-items: start;
  justify-content: space-between;
}

.admin-card-head h2 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
}

.admin-meta,
.admin-memory {
  color: var(--muted);
  line-height: 1.75;
}

.admin-consent {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.82rem;
  font-weight: 900;
  white-space: nowrap;
}

.admin-consent.ok {
  color: #2d6b63;
  background: rgba(143, 210, 200, 0.2);
}

.admin-consent.warn {
  color: #8b3a2a;
  background: rgba(233, 143, 115, 0.16);
}

.admin-card-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 260px);
  gap: 18px;
}

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

.admin-fields div {
  min-width: 0;
}

.admin-fields dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.admin-fields dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}

.admin-photos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(76px, 1fr));
  gap: 10px;
  align-content: start;
}

.admin-photos img {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
}

.admin-note {
  margin-top: 16px;
  display: grid;
  gap: 8px;
}

.admin-note span {
  color: #526064;
  font-size: 0.9rem;
  font-weight: 800;
}

.admin-card-actions .button:disabled,
.admin-note textarea:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.submission-panel {
  position: sticky;
  top: 86px;
}

.submission-panel h3 {
  margin: 0 0 12px;
  font-size: clamp(1.45rem, 3vw, 2.2rem);
  line-height: 1.12;
}

.submission-panel p {
  color: #4d5b5f;
  line-height: 1.75;
}

.submission-preview {
  margin-top: 18px;
}

.submission-card {
  min-height: auto;
}

/* ---- 照片上传 ---- */
.photo-uploads {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.photo-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.photo-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.photo-drop {
  position: relative;
  aspect-ratio: 1;
  border: 2px dashed var(--line);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.4);
  transition: border-color 0.2s, background 0.2s;
}

.photo-drop:hover {
  border-color: var(--mint);
  background: rgba(143, 210, 200, 0.08);
}

.photo-drop.drag-over {
  border-color: var(--mint);
  background: rgba(143, 210, 200, 0.14);
}

.photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.85rem;
  pointer-events: none;
}

.photo-icon {
  font-size: 2rem;
  opacity: 0.6;
}

.photo-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.2s;
}

.photo-remove:hover {
  background: rgba(200, 60, 60, 0.85);
}

/* 预览中的照片缩略图 */
.preview-photos {
  display: flex;
  gap: 8px;
  margin: 8px 0;
  overflow-x: auto;
}

.preview-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.empty {
  border: 1px dashed rgba(39, 48, 51, 0.24);
  border-radius: 8px;
  padding: 26px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.64);
}

.empty.compact {
  padding: 16px;
}

/* ---- 主题切换按钮 ---- */
.theme-toggle {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--topnav-bg);
  color: var(--ink);
  font-size: 1.25rem;
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
  line-height: 1;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  border-color: rgba(39, 48, 51, 0.28);
}

/* ---- 深色模式全局覆盖 ---- */
[data-theme="dark"] .topnav a {
  color: #b5b0a6;
}

[data-theme="dark"] .topnav a:hover,
[data-theme="dark"] .topnav a.active {
  color: #e8e4dd;
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .lede {
  color: #b0aaa0;
}

[data-theme="dark"] .button,
[data-theme="dark"] .filter,
[data-theme="dark"] .subtle {
  background: rgba(33, 37, 43, 0.78);
  color: #d5d0c8;
}

[data-theme="dark"] .button:hover,
[data-theme="dark"] .filter:hover {
  border-color: rgba(200, 195, 188, 0.32);
}

[data-theme="dark"] .primary {
  color: #1a1d21;
  background: linear-gradient(135deg, var(--gold), var(--coral));
}

[data-theme="dark"] .filter.active {
  background: #e8e4dd;
  color: #1a1d21;
}

[data-theme="dark"] .stats,
[data-theme="dark"] .toolbar,
[data-theme="dark"] .wall-notice,
[data-theme="dark"] .planet-map:not(.planet-showcase),
[data-theme="dark"] .resident-page,
[data-theme="dark"] .single-resident,
[data-theme="dark"] .add-memory,
[data-theme="dark"] .submission-form,
[data-theme="dark"] .submission-panel,
[data-theme="dark"] .about-hero,
[data-theme="dark"] .about-card,
[data-theme="dark"] .about-section,
[data-theme="dark"] .about-steps article,
[data-theme="dark"] .faq-list details,
[data-theme="dark"] .guardian-panel,
[data-theme="dark"] .admin-card {
  background: var(--glass-bg);
}

[data-theme="dark"] .card,
[data-theme="dark"] .wall-card {
  background: var(--panel);
}

[data-theme="dark"] .card small,
[data-theme="dark"] .wall-owner {
  color: var(--muted);
}

[data-theme="dark"] .memory {
  color: #b0aaa0;
}

[data-theme="dark"] .tags li {
  background: #2a2d33;
  color: #c5bfb5;
}

[data-theme="dark"] .resident-notes article,
[data-theme="dark"] .form-status,
[data-theme="dark"] .consent-check {
  background: rgba(26, 29, 33, 0.7);
}

[data-theme="dark"] .form-status.success {
  border-color: var(--mint);
  color: #8fd2c8;
  background: rgba(106, 184, 175, 0.12);
}

[data-theme="dark"] .form-status.error {
  border-color: var(--coral);
  color: #e98f73;
  background: rgba(212, 122, 94, 0.12);
}

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: #1a1d21;
  color: #e8e4dd;
  border-color: var(--line);
}

[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus {
  border-color: var(--coral);
  box-shadow: 0 0 0 4px rgba(212, 122, 94, 0.25);
}

[data-theme="dark"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%239a978f' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
}

[data-theme="dark"] select:hover {
  border-color: var(--mint);
  background-color: #1e2826;
}

[data-theme="dark"] select:focus {
  border-color: var(--coral);
  box-shadow: 0 0 0 4px rgba(212, 122, 94, 0.25);
  background-color: #1a1d21;
}

[data-theme="dark"] select option {
  background: #1e2228;
  color: #e8e4dd;
}

[data-theme="dark"] select option:checked {
  background: var(--mint);
  color: #0d2b26;
}

[data-theme="dark"] select optgroup {
  color: #8a8780;
}

/* 自定义下拉 - 深色 */
[data-theme="dark"] .custom-select-trigger {
  background: #1a1d21;
  color: #e8e4dd;
}

[data-theme="dark"] .custom-select-trigger:hover {
  border-color: var(--mint);
  background-color: #1e2826;
}

[data-theme="dark"] .custom-select-trigger.open {
  background-color: #1a1d21;
}

[data-theme="dark"] .custom-select-arrow {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%239a978f' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
}

[data-theme="dark"] .custom-select-panel {
  background: #1e2228;
  border-color: var(--coral);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .custom-select-option {
  color: #e8e4dd;
}

[data-theme="dark"] .custom-select-option:hover {
  background: rgba(106, 184, 175, 0.12);
  color: #8fd2c8;
}

[data-theme="dark"] .custom-select-option.active {
  background: var(--mint);
  color: #0d2b26;
}

[data-theme="dark"] .custom-select-option:first-child {
  color: #8a8780;
}

[data-theme="dark"] .search-field span,
[data-theme="dark"] .memory-form span,
[data-theme="dark"] .submission-form span,
[data-theme="dark"] .admin-note span {
  color: #b0aaa0;
}

[data-theme="dark"] .photo-drop {
  background: rgba(26, 29, 33, 0.5);
  border-color: rgba(200, 195, 188, 0.18);
}

[data-theme="dark"] .photo-drop:hover {
  border-color: var(--mint);
  background: rgba(106, 184, 175, 0.1);
}

[data-theme="dark"] .photo-placeholder {
  color: #8a8780;
}

[data-theme="dark"] .site-footer {
  color: rgba(200, 195, 188, 0.5);
}

[data-theme="dark"] .footer-sep {
  color: rgba(200, 195, 188, 0.2);
}

[data-theme="dark"] .legal-content h2 {
  color: #e8e4dd;
}

[data-theme="dark"] .legal-content p,
[data-theme="dark"] .legal-content ul {
  color: #9a978f;
}

[data-theme="dark"] .legal-content strong {
  color: #e8e4dd;
}

[data-theme="dark"] .eyebrow {
  color: var(--coral);
}

[data-theme="dark"] .back-link {
  color: #b0aaa0;
}

[data-theme="dark"] .back-link:hover {
  color: var(--coral);
}

[data-theme="dark"] .share-preview pre {
  background: var(--paper);
  border-color: rgba(200, 195, 188, 0.18);
  color: var(--text-soft);
}

[data-theme="dark"] .submission-panel p,
[data-theme="dark"] .wall-notice p {
  color: #b0aaa0;
}

[data-theme="dark"] .single-memory {
  color: #b0aaa0;
}

[data-theme="dark"] .resident-notes span,
[data-theme="dark"] .memorial-note span {
  color: var(--muted);
}

[data-theme="dark"] .resident-notes strong {
  color: #e8e4dd;
}

[data-theme="dark"] .wall-notice strong {
  color: #e8e4dd;
}

[data-theme="dark"] .wall-notice span {
  color: var(--coral);
}

[data-theme="dark"] .planet-face {
  color: rgba(200, 195, 188, 0.7);
}

[data-theme="dark"] .planet::before,
[data-theme="dark"] .planet::after {
  background: #c5bfb5;
}

[data-theme="dark"] .three-planet-stage {
  background:
    radial-gradient(circle at 20% 22%, rgba(255, 255, 255, 0.15) 0 1px, transparent 2px),
    radial-gradient(circle at 78% 18%, rgba(242, 195, 107, 0.22) 0 1px, transparent 2px),
    radial-gradient(circle at 68% 76%, rgba(143, 210, 200, 0.18) 0 1px, transparent 2px),
    radial-gradient(circle at 88% 64%, rgba(255, 255, 255, 0.1) 0 1px, transparent 2px),
    radial-gradient(circle at 30% 78%, rgba(143, 210, 200, 0.15) 0 1px, transparent 2px),
    radial-gradient(circle at 50% 50%, rgba(233, 143, 115, 0.12), transparent 42%),
    linear-gradient(145deg, #111418, #1a1e24 48%, #1c1828);
}

[data-theme="dark"] .resident-chip {
  background: #1a1d21;
  color: #e8e4dd;
}

[data-theme="dark"] .gateway-link {
  background: rgba(33, 37, 43, 0.78);
}

[data-theme="dark"] .empty {
  background: rgba(33, 37, 43, 0.55);
}

[data-theme="dark"] .single-portrait {
  background:
    radial-gradient(circle at 50% 48%, rgba(255, 255, 255, 0.12), transparent 0 36%),
    radial-gradient(circle at 28% 22%, rgba(242, 195, 107, 0.15), transparent 0 28%),
    linear-gradient(135deg, rgba(143, 210, 200, 0.14), rgba(138, 106, 168, 0.08));
}

[data-theme="dark"] .resident-portrait {
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.12), transparent 0 42%),
    linear-gradient(135deg, rgba(143, 210, 200, 0.14), rgba(242, 195, 107, 0.1));
}

[data-theme="dark"] .single-memory {
  color: var(--text-soft);
}

[data-theme="dark"] .memorial-note article,
[data-theme="dark"] .resident-notes article {
  background: rgba(26, 29, 33, 0.5);
}

[data-theme="dark"] .danger {
  color: #e07060;
}

[data-theme="dark"] .danger:hover {
  border-color: rgba(224, 112, 96, 0.4);
  background: rgba(224, 112, 96, 0.1);
}

[data-theme="dark"] .planet-ring {
  border-color: rgba(255, 255, 255, 0.25);
  border-left-color: rgba(212, 168, 75, 0.4);
  border-right-color: rgba(212, 122, 94, 0.35);
}

[data-theme="dark"] .wall-card.lit {
  border-color: rgba(212, 168, 75, 0.55);
  box-shadow: 0 18px 48px rgba(212, 168, 75, 0.12);
}

[data-theme="dark"] .world-panel {
  background:
    radial-gradient(circle at 86% 38%, rgba(155, 126, 196, 0.12), transparent 0 30%),
    linear-gradient(135deg, rgba(26, 29, 33, 0.92), rgba(212, 168, 75, 0.08));
}

[data-theme="dark"] .ritual-panel {
  background:
    radial-gradient(circle at 82% 26%, rgba(212, 168, 75, 0.12), transparent 0 26%),
    linear-gradient(135deg, rgba(26, 29, 33, 0.92), rgba(106, 184, 175, 0.08));
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}


@keyframes twinkle {

  0%,
  100% {
    opacity: 0.5;
    scale: 0.92;
  }

  50% {
    opacity: 1;
    scale: 1.12;
  }
}

@keyframes resident-loader-bob {

  0%,
  100% {
    transform: translateY(0) rotate(-2deg);
  }

  50% {
    transform: translateY(-8px) rotate(3deg);
  }
}

@keyframes resident-loader-progress {
  0% {
    transform: translateX(-110%);
  }

  55% {
    transform: translateX(80%);
  }

  100% {
    transform: translateX(250%);
  }
}

@keyframes resident-loader-copy {
  0% {
    content: "鼠鼠正在起床……";
  }

  20% {
    content: "鼠鼠正在洗澡……";
  }

  40% {
    content: "鼠鼠正在梳毛毛……";
  }

  60% {
    content: "鼠鼠正在找瓜子……";
  }

  80% {
    content: "鼠鼠正在跑向你……";
  }
}

@media (max-width: 860px) {
  .hero {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 0;
    padding-top: 12px;
  }

  .home-shell {
    display: block;
  }

  .home-shell .hero {
    padding: 12px 0 22px;
  }

  .hero-art {
    min-height: 300px;
  }

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

  .admin-toolbar,
  .admin-card-grid {
    grid-template-columns: 1fr;
  }

  .resident-hero,
  .single-hero,
  .home-gateway,
  .about-hero,
  .about-grid,
  .guardian-panel,
  .submit-layout {
    grid-template-columns: 1fr;
  }

  .about-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .about-orbit {
    width: min(72vw, 240px);
  }

  .submission-panel {
    position: static;
  }

  .three-planet-stage {
    min-height: min(720px, calc(100vh - 180px));
  }

  .three-planet-canvas {
    width: min(90vw, 620px);
    height: min(90vw, 620px);
  }

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

  .wall-cards,
  .wall-notice {
    grid-template-columns: 1fr;
  }

  .wall-section-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .wall-filters {
    width: 100%;
  }

  .memorial-note {
    grid-template-columns: repeat(2, 1fr);
  }

  .ritual-panel,
  .world-panel,
  .note-form,
  .capsule-form {
    grid-template-columns: 1fr;
  }

  .ritual-stars {
    min-width: 100%;
  }

  .memorial-note article:nth-child(2) {
    border-right: 0;
  }

  .memorial-note article:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .wall-notice article {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .wall-notice article:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 620px) {
  .topbar {
    width: min(100% - 22px, 1120px);
    min-height: auto;
    align-items: stretch;
    flex-direction: column;
  }

  .topnav {
    width: 100%;
    justify-content: space-between;
  }

  .topnav a {
    flex: 1 1 30%;
    justify-content: center;
    padding: 0 8px;
    font-size: 0.88rem;
  }

  .shell {
    width: min(100% - 22px, 1120px);
    padding-bottom: 32px;
  }

  .home-shell {
    padding-bottom: 24px;
  }

  .site-footer {
    width: min(100% - 22px, 1120px);
    min-height: 64px;
    padding-bottom: 16px;
  }

  .legal-content {
    padding: 0 4px 40px;
  }

  .stats,
  .cards,
  .wall-cards,
  .memory-form,
  .form-grid,
  .note-form,
  .capsule-form,
  .about-steps,
  .resident-notes {
    grid-template-columns: 1fr;
  }

  .stats article {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .stats article:last-child {
    border-bottom: 0;
  }

  .planet {
    width: min(78vw, 280px);
  }

  .hero-actions .button,
  .filter {
    flex: 1 1 auto;
  }

  .planet-map,
  .resident-page,
  .single-resident,
  .add-memory,
  .submission-form,
  .submission-panel,
  .about-hero,
  .about-card,
  .about-section,
  .admin-card {
    padding: 18px;
  }

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

  .admin-fields {
    grid-template-columns: 1fr;
  }

  .planet-showcase {
    padding: 0;
  }

  .map-region-panel {
    padding: 18px;
  }

  .map-residents-cards {
    grid-template-columns: 1fr;
  }

  .three-planet-stage {
    min-height: min(520px, calc(100vh - 150px));
  }

  .three-planet-canvas {
    width: min(94vw, 430px);
    height: min(94vw, 430px);
  }

  .memorial-note {
    grid-template-columns: 1fr;
  }

  .memorial-note article,
  .memorial-note article:nth-child(2) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .memorial-note article:last-child {
    border-bottom: 0;
  }
}

/* ---- 时光轴 ---- */
.timeline {
  position: relative;
  padding: 0 0 60px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--line);
  transform: translateX(-50%);
}

.timeline-year {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  margin: 44px 0 32px;
}

.timeline-year:first-child {
  margin-top: 10px;
}

.timeline-year-label {
  display: inline-block;
  padding: 8px 28px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 1.1rem;
  font-weight: 900;
  box-shadow: 0 6px 18px rgba(38, 53, 61, 0.08);
}

.timeline-entry {
  position: relative;
  width: 50%;
  padding: 0 48px 36px;
  box-sizing: border-box;
}

.timeline-entry.left {
  left: 0;
  text-align: right;
}

.timeline-entry.right {
  left: 50%;
  text-align: left;
}

.timeline-dot {
  position: absolute;
  top: 16px;
  z-index: 3;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid var(--panel);
  box-shadow: 0 4px 12px rgba(38, 53, 61, 0.15);
}

.timeline-entry.left .timeline-dot {
  right: -9px;
}

.timeline-entry.right .timeline-dot {
  left: -9px;
}

.timeline-card {
  display: block;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 26px rgba(38, 53, 61, 0.06);
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.timeline-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 36px rgba(38, 53, 61, 0.12);
  border-color: rgba(39, 48, 51, 0.24);
}

.timeline-date {
  display: block;
  margin-bottom: 10px;
  color: var(--coral);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.timeline-card-top {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}

.timeline-entry.left .timeline-card-top {
  flex-direction: row-reverse;
}

.timeline-card-top h3 {
  margin: 0 0 3px;
  font-size: 1.18rem;
}

.timeline-card-top small {
  color: var(--muted);
  font-size: 0.88rem;
}

.timeline-memory {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.7;
}

/* ---- 时光轴深色模式 ---- */
[data-theme="dark"] .timeline::before {
  background: var(--line);
}

[data-theme="dark"] .timeline-year-label {
  background: var(--panel);
  border-color: var(--line);
}

[data-theme="dark"] .timeline-card {
  background: var(--panel);
}

[data-theme="dark"] .timeline-dot {
  border-color: var(--panel);
}

/* ---- 时光轴响应式 ---- */
@media (max-width: 760px) {
  .timeline::before {
    left: 20px;
  }

  .timeline-entry {
    width: 100%;
    left: 0 !important;
    text-align: left !important;
    padding: 0 0 28px 52px;
  }

  .timeline-entry.left .timeline-dot,
  .timeline-entry.right .timeline-dot {
    left: 11px;
    right: auto;
  }

  .timeline-entry.left .timeline-card-top {
    flex-direction: row;
  }

  .timeline-year {
    justify-content: flex-start;
    padding-left: 52px;
  }
}