:root {
  --app-viewport-height: 100vh;
  /* ---- Cosmic dark base ---- */
  --bg: #05050c;              /* near-black space */
  --bg-2: #0c0a1e;           /* deep indigo */
  --bg-3: #16123a;           /* nebula violet */

  /* ---- Liquid-glass material (iOS-26-like) — one tunable set, reused by
         every glass surface (cards, buttons, inputs, sidebar, toggles) ---- */
  --glass-blur: 26px;                             /* backdrop blur strength */
  --glass-saturate: 175%;                          /* vibrancy of what shows through */
  --glass-fill: rgba(255, 255, 255, 0.045);        /* main translucent tint — low, so cosmos shows */
  --glass-fill-strong: rgba(255, 255, 255, 0.085); /* hover / raised */
  --glass-faint: rgba(255, 255, 255, 0.035);       /* nested rows */
  --glass-border: rgba(255, 255, 255, 0.16);       /* base edge */
  --glass-sheen: rgba(255, 255, 255, 0.24);        /* top reflection peak */
  --glass-rim: rgba(255, 255, 255, 0.6);           /* crisp top rim light */
  --glass-rim-soft: rgba(255, 255, 255, 0.15);     /* side rim light */
  --glass-inner: rgba(255, 255, 255, 0.12);        /* soft inner glow */
  --glass-refract-1: rgba(150, 170, 255, 0.24);    /* violet edge refraction */
  --glass-refract-2: rgba(120, 205, 255, 0.17);    /* cyan edge refraction */
  --glass-cast: 0 16px 46px rgba(0, 0, 0, 0.5);    /* outer depth shadow */
  --glass-halo: 0 0 44px rgba(90, 110, 220, 0.1);  /* faint coloured halo */
  --text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);    /* subtle contrast lift on glass */

  /* Content-card liquid glass: kept separate from navigation controls so the
     larger surfaces can be more optical without making the sidebar too loud. */
  --card-glass-blur: 38px;
  --card-glass-saturate: 185%;
  --card-glass-base: rgba(7, 10, 28, 0.14);
  --card-glass-border: rgba(235, 241, 255, 0.31);
  --card-glass-top-rim: rgba(255, 255, 255, 0.52);
  --card-glass-side-rim: rgba(226, 233, 255, 0.22);
  --card-glass-sheen: rgba(255, 255, 255, 0.15);
  --card-glass-inner: rgba(218, 229, 255, 0.16);
  --card-glass-refract-blue: rgba(118, 181, 255, 0.13);
  --card-glass-refract-violet: rgba(180, 131, 255, 0.1);
  --card-glass-shadow:
    0 22px 58px rgba(1, 4, 18, 0.22),
    inset 0 1px 0 var(--card-glass-top-rim),
    inset 1px 0 0 var(--card-glass-side-rim),
    inset 0 18px 30px -20px var(--card-glass-inner),
    inset -18px -18px 30px -26px var(--card-glass-refract-blue),
    inset 18px -14px 28px -25px var(--card-glass-refract-violet);

  /* Reusable glossy top-reflection gradient (paints under content, so text stays crisp) */
  --glass-sheen-grad: linear-gradient(157deg, var(--glass-sheen) 0%, rgba(255, 255, 255, 0.06) 24%, transparent 52%);

  /* Reusable multi-layer glass shadow stack: outer depth + coloured halo +
     top/side rim light + inner glow + two coloured edge refractions. */
  --glass-shadow:
    var(--glass-cast),
    var(--glass-halo),
    inset 0 1px 0 var(--glass-rim),
    inset 1px 0 0 var(--glass-rim-soft),
    inset -1px 0 0 var(--glass-rim-soft),
    inset 0 16px 28px -18px var(--glass-inner),
    inset 0 -24px 36px -28px var(--glass-refract-1),
    inset 22px 0 36px -28px var(--glass-refract-2);

  /* legacy aliases still referenced by a few rules */
  --glass: var(--glass-fill);
  --glass-strong: var(--glass-fill-strong);
  --glass-highlight: var(--glass-rim);
  --blur: var(--glass-blur);

  /* ---- Text ---- */
  --text: #edecf7;
  --subtitle: #a3a3c0;

  /* ---- Luminous accent (periwinkle / starlight violet) ---- */
  --accent: #8ea2ff;
  --accent-strong: #b3c0ff;
  --accent-glow: rgba(142, 162, 255, 0.45);
  --accent-soft: rgba(142, 162, 255, 0.18);

  --danger: #ff8fa0;
  --success: #8fe3bf;

  /* ---- Back-compat aliases: old names now point at the dark-glass palette
         so the existing rules keep working without renaming everywhere ---- */
  --card: var(--glass);
  --card-alt: var(--glass-faint);
  --moss: var(--accent);
  --moss-dark: var(--accent-strong);
  --moss-soft: var(--accent-soft);
  --wood: var(--glass-border);
  --wood-dark: var(--accent-strong);
  --morning: var(--accent);
  --morning-soft: var(--accent-soft);
  --border: var(--glass-border);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans SC", -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  min-height: 100vh;
  background-color: var(--bg);
  /* Layered cosmos: a tiled starfield over soft nebula glows over the base black.
     First listed layer sits on top, so stars render above the coloured nebulae. */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='420' height='420' viewBox='0 0 420 420'%3E%3Cg fill='%23ffffff'%3E%3Ccircle cx='24' cy='36' r='.9' opacity='.7'/%3E%3Ccircle cx='68' cy='18' r='.5' opacity='.4'/%3E%3Ccircle cx='104' cy='60' r='1.2' opacity='.85'/%3E%3Ccircle cx='150' cy='30' r='.6' opacity='.5'/%3E%3Ccircle cx='188' cy='54' r='.8' opacity='.6'/%3E%3Ccircle cx='224' cy='22' r='1.5' opacity='.9'/%3E%3Ccircle cx='262' cy='58' r='.5' opacity='.4'/%3E%3Ccircle cx='300' cy='34' r='.9' opacity='.7'/%3E%3Ccircle cx='340' cy='20' r='.6' opacity='.5'/%3E%3Ccircle cx='378' cy='52' r='1.1' opacity='.8'/%3E%3Ccircle cx='40' cy='104' r='.6' opacity='.5'/%3E%3Ccircle cx='86' cy='128' r='1.0' opacity='.8'/%3E%3Ccircle cx='128' cy='104' r='.5' opacity='.4'/%3E%3Ccircle cx='166' cy='140' r='.8' opacity='.65'/%3E%3Ccircle cx='206' cy='112' r='.6' opacity='.5'/%3E%3Ccircle cx='244' cy='146' r='1.3' opacity='.85'/%3E%3Ccircle cx='286' cy='108' r='.7' opacity='.55'/%3E%3Ccircle cx='330' cy='142' r='.5' opacity='.4'/%3E%3Ccircle cx='372' cy='116' r='.9' opacity='.7'/%3E%3Ccircle cx='28' cy='180' r='1.1' opacity='.85'/%3E%3Ccircle cx='72' cy='208' r='.6' opacity='.5'/%3E%3Ccircle cx='112' cy='184' r='.8' opacity='.6'/%3E%3Ccircle cx='196' cy='190' r='1.0' opacity='.8'/%3E%3Ccircle cx='236' cy='216' r='.6' opacity='.5'/%3E%3Ccircle cx='276' cy='192' r='.8' opacity='.65'/%3E%3Ccircle cx='330' cy='198' r='1.6' opacity='.95'/%3E%3Ccircle cx='370' cy='224' r='.7' opacity='.55'/%3E%3Ccircle cx='22' cy='260' r='.7' opacity='.55'/%3E%3Ccircle cx='60' cy='292' r='1.0' opacity='.8'/%3E%3Ccircle cx='100' cy='268' r='.5' opacity='.4'/%3E%3Ccircle cx='150' cy='300' r='.8' opacity='.6'/%3E%3Ccircle cx='214' cy='302' r='1.2' opacity='.85'/%3E%3Ccircle cx='256' cy='276' r='.5' opacity='.4'/%3E%3Ccircle cx='300' cy='306' r='.9' opacity='.7'/%3E%3Ccircle cx='344' cy='280' r='.6' opacity='.5'/%3E%3Ccircle cx='384' cy='312' r='.8' opacity='.6'/%3E%3Ccircle cx='40' cy='336' r='.6' opacity='.5'/%3E%3Ccircle cx='88' cy='366' r='.9' opacity='.7'/%3E%3Ccircle cx='160' cy='372' r='.8' opacity='.6'/%3E%3Ccircle cx='202' cy='344' r='1.3' opacity='.9'/%3E%3Ccircle cx='250' cy='374' r='.6' opacity='.5'/%3E%3Ccircle cx='300' cy='350' r='.7' opacity='.55'/%3E%3Ccircle cx='356' cy='378' r='1.0' opacity='.8'/%3E%3Ccircle cx='392' cy='352' r='.6' opacity='.5'/%3E%3C/g%3E%3C/svg%3E"),
    radial-gradient(ellipse 70% 55% at 18% -8%, rgba(96, 74, 201, 0.30), transparent 60%),
    radial-gradient(ellipse 65% 55% at 88% 6%, rgba(48, 102, 214, 0.22), transparent 55%),
    radial-gradient(ellipse 95% 75% at 50% 114%, rgba(126, 60, 168, 0.26), transparent 62%);
  background-repeat: repeat, no-repeat, no-repeat, no-repeat;
  background-size: 420px 420px, auto, auto, auto;
  background-attachment: fixed;
}

/* Photographic starfield: keep the center dark for content and let the
   natural, irregular stars replace the earlier repeated SVG-dot pattern. */
body {
  background-color: #03040a;
  background-image:
    radial-gradient(ellipse 82% 58% at 50% 44%, rgba(36, 49, 91, 0.12), transparent 68%),
    radial-gradient(ellipse 52% 42% at 9% 94%, rgba(64, 43, 103, 0.08), transparent 70%),
    radial-gradient(ellipse 46% 38% at 94% 6%, rgba(38, 67, 108, 0.07), transparent 72%),
    radial-gradient(circle at 8% 18%, rgba(214, 224, 255, 0.32) 0 0.65px, transparent 1px),
    radial-gradient(circle at 22% 71%, rgba(194, 207, 255, 0.22) 0 0.55px, transparent 1px),
    radial-gradient(circle at 39% 13%, rgba(224, 230, 255, 0.24) 0 0.55px, transparent 1px),
    radial-gradient(circle at 63% 78%, rgba(194, 204, 255, 0.2) 0 0.55px, transparent 1px),
    radial-gradient(circle at 76% 32%, rgba(221, 227, 255, 0.25) 0 0.65px, transparent 1px),
    radial-gradient(circle at 91% 63%, rgba(193, 205, 255, 0.2) 0 0.55px, transparent 1px),
    linear-gradient(145deg, #020309 0%, #050611 48%, #020208 100%);
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
}

h1, h2 {
  font-family: "Noto Serif SC", "Songti SC", serif;
}

/* Home only: a restrained, near-black space field. The photographic star map
   remains available to the rest of the app; this view uses sparse, low-lumen
   points and atmospheric depth so the Saturn mark remains the focal point. */
body:has(.view.active[data-view-panel="home"]) {
  background-color: #03040a;
  background-image:
    radial-gradient(ellipse 82% 58% at 50% 44%, rgba(36, 49, 91, 0.12), transparent 68%),
    radial-gradient(ellipse 52% 42% at 9% 94%, rgba(64, 43, 103, 0.08), transparent 70%),
    radial-gradient(ellipse 46% 38% at 94% 6%, rgba(38, 67, 108, 0.07), transparent 72%),
    radial-gradient(circle at 8% 18%, rgba(214, 224, 255, 0.32) 0 0.65px, transparent 1px),
    radial-gradient(circle at 22% 71%, rgba(194, 207, 255, 0.22) 0 0.55px, transparent 1px),
    radial-gradient(circle at 39% 13%, rgba(224, 230, 255, 0.24) 0 0.55px, transparent 1px),
    radial-gradient(circle at 63% 78%, rgba(194, 204, 255, 0.2) 0 0.55px, transparent 1px),
    radial-gradient(circle at 76% 32%, rgba(221, 227, 255, 0.25) 0 0.65px, transparent 1px),
    radial-gradient(circle at 91% 63%, rgba(193, 205, 255, 0.2) 0 0.55px, transparent 1px),
    linear-gradient(145deg, #020309 0%, #050611 48%, #020208 100%);
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
}

/* Home entrance: a restrained reveal that never blocks interaction. */
#app-screen.home-entrance-prime,
#app-screen.home-entrance-first {
  position: relative;
  z-index: 1;
}

body.home-entrance-prime::before,
body.home-entrance-first::before {
  content: "";
  position: fixed;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  background: #010104;
}

body.home-entrance-prime::before {
  opacity: 1;
}

body.home-entrance-first::before {
  animation: homeBackgroundReveal 0.52s ease-out forwards;
}

#app-screen.home-entrance-prime .home-logo,
#app-screen.home-entrance-first .home-logo {
  opacity: 0;
}

#app-screen.home-entrance-first .home-logo {
  animation: homeSaturnReveal 0.56s 0.28s ease-out forwards;
}

#app-screen.home-entrance-prime .home-greeting,
#app-screen.home-entrance-first .home-greeting {
  opacity: 0;
}

#app-screen.home-entrance-first .home-greeting {
  animation: homeGreetingReveal 0.42s 0.72s ease-out forwards;
}

#app-screen.home-entrance-prime .sidebar,
#app-screen.home-entrance-first .sidebar {
  opacity: 0;
}

#app-screen.home-entrance-first .sidebar {
  animation: homeSidebarReveal 0.34s 1.04s ease-out forwards;
}

#app-screen.home-entrance-returning {
  animation: homeReturnReveal 0.3s ease-out both;
}

@keyframes homeBackgroundReveal {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes homeSaturnReveal {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes homeGreetingReveal {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes homeSidebarReveal {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes homeReturnReveal {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  body.home-entrance-first::before,
  #app-screen.home-entrance-first .home-logo,
  #app-screen.home-entrance-first .home-greeting,
  #app-screen.home-entrance-first .sidebar,
  #app-screen.home-entrance-returning {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

.screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 12px 40px;
}

#app-screen.screen {
  align-items: stretch;
  padding: 0;
  min-height: 100vh;
}

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
}

/* Use the live mobile viewport rather than legacy 100vh, whose height can
   extend beneath the browser address/navigation bars. */
@supports (height: 100dvh) {
  body,
  .screen,
  #app-screen.screen,
  .app-shell {
    min-height: 100dvh;
  }

  .sidebar {
    height: 100dvh;
  }
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 25;
}

.sidebar-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 250px;
  max-width: 80vw;
  z-index: 30;
  display: flex;
  flex-direction: column;
  isolation: isolate;
  overflow: hidden;
  background:
    linear-gradient(154deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0.025) 16%, transparent 40%),
    radial-gradient(ellipse 85% 42% at 18% 0%, rgba(255, 255, 255, 0.055), transparent 68%),
    linear-gradient(155deg, rgba(8, 10, 18, 0.24), rgba(1, 2, 8, 0.1));
  backdrop-filter: blur(14px) saturate(135%);
  -webkit-backdrop-filter: blur(14px) saturate(135%);
  border-right: 1px solid rgba(235, 239, 255, 0.24);
  padding: 24px 14px;
  gap: 4px;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 10px 0 42px rgba(0, 0, 0, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.34), inset 1px 0 0 rgba(255, 255, 255, 0.1), inset -1px 0 0 rgba(207, 215, 255, 0.12);
}

.sidebar::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(108deg, rgba(255, 255, 255, 0.12), transparent 21% 79%, rgba(210, 220, 255, 0.045));
  opacity: 0.28;
}

.sidebar-brand,
.menu-group {
  position: relative;
  z-index: 1;
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 12px 22px;
  font-family: "Noto Serif SC", serif;
  font-weight: 700;
  font-size: 20px;
  color: var(--moss-dark);
}

.sidebar-brand-icon {
  display: inline-flex;
  align-items: center;
  width: 64px;
  height: 44px;
  margin-left: -4px;
}

.sidebar-brand-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 5px rgba(227, 184, 105, 0.35));
}

.menu-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-height: 0;
  animation: menuIn 0.28s ease;
}

.menu-group[hidden] {
  display: none;
}

@keyframes menuIn {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.space-exit-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  background: transparent;
  color: var(--subtitle);
  border: 1.5px dashed var(--border);
  border-radius: 12px;
  box-shadow: none;
  padding: 10px 14px;
  min-height: auto;
  font-size: 14px;
  text-align: left;
}

.space-exit-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--wood-dark);
}

.space-exit-btn:active {
  transform: none;
  box-shadow: none;
}

.space-menu-friend {
  margin: 2px 0 10px;
  padding: 8px 14px 10px;
  font-family: "Noto Serif SC", serif;
  font-weight: 700;
  font-size: 18px;
  color: var(--moss-dark);
  border-bottom: 2px dashed var(--border);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker-hint {
  color: var(--subtitle);
  font-size: 13px;
  margin: 0 0 12px;
}

.sidebar-toggle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 44px;
  height: 44px;
  padding: 0;
  min-height: auto;
  border-radius: 50%;
  background: var(--glass-sheen-grad), var(--glass-fill-strong);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

.hamburger-bar {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 1px;
  background: var(--text);
}

.sidebar-toggle:hover {
  background: var(--glass-strong);
  border-color: rgba(160, 178, 255, 0.5);
}

/* The drawer owns the top-left corner while it is open. Hiding the trigger
   prevents it from sitting on top of the Saturn brand mark on mobile. */
.sidebar-is-open .sidebar-toggle {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.82);
}

.friends-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  min-height: auto;
  border-radius: 50%;
  background: var(--card);
  border: 2px solid var(--wood);
  box-shadow: var(--shadow);
  font-size: 19px;
}

.friends-toggle:hover {
  background: var(--card);
}

.nav-indicator {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.075), rgba(208, 216, 245, 0.035));
  border: 1px solid rgba(230, 236, 255, 0.1);
  border-radius: 12px;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), width 0.28s ease, height 0.28s ease;
  z-index: 0;
  pointer-events: none;
}

.nav-item {
  position: relative;
  z-index: 1;
  flex: none;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  min-height: auto;
  background: transparent;
  color: var(--subtitle);
  border: none;
  box-shadow: none;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  text-align: left;
  border: 1px solid transparent;
  transition: color 0.22s ease, background 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.nav-item:hover {
  background: linear-gradient(132deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.035));
  border-color: rgba(236, 240, 255, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.nav-item:active {
  transform: none;
  box-shadow: none;
}

.nav-item.active {
  color: #f4f5ff;
  font-weight: 700;
  background: linear-gradient(132deg, rgba(255, 255, 255, 0.19), rgba(226, 231, 248, 0.065));
  border-color: rgba(237, 241, 255, 0.28);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 -1px 0 rgba(216, 224, 255, 0.1);
}

/* Keep the surrounding drawer transparent, while giving controls their own
   darker glass layer so bright background elements never compete with labels. */
.sidebar .nav-item,
.sidebar .space-exit-btn {
  background: transparent;
  border-color: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
}

.sidebar .nav-item:hover,
.sidebar .space-exit-btn:hover {
  background: linear-gradient(132deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.025));
  border-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.sidebar .nav-item.active {
  background: linear-gradient(132deg, rgba(255, 255, 255, 0.13), rgba(224, 231, 255, 0.04));
  border-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), inset 0 -1px 0 rgba(216, 224, 255, 0.04);
}

.nav-icon {
  font-size: 20px;
  line-height: 1;
  display: inline-block;
  transition: transform 0.2s ease;
}

.nav-icon-lucide {
  display: none;
}

.nav-item:hover .nav-icon {
  transform: scale(1.15) rotate(-4deg);
}

.nav-item.active .nav-icon {
  transform: scale(1.1);
}

.nav-label {
  white-space: nowrap;
}

.nav-settings {
  color: var(--subtitle);
  margin-top: auto;
}

.content-area {
  flex: 1;
  min-width: 0;
  padding: 20px 16px 48px;
  display: flex;
  flex-direction: column;
}

.view {
  display: none;
  max-width: 640px;
}

.view.active[data-view-panel="home"] {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  max-width: none;
  padding-bottom: 10vh;
  /* Transparent but still hit-testable — without this it silently eats clicks
     meant for the header buttons above it. Re-enable on any element added here
     that needs to be clickable. */
  pointer-events: none;
}

.home-logo {
  font-size: 64px;
  line-height: 1;
  margin-bottom: 8px;
}

.home-greeting {
  margin: 0;
  padding: 0 12px;
  font-family: "Noto Serif SC", serif;
  font-weight: 700;
  font-size: clamp(20px, 6vw, 28px);
  line-height: 1.4;
  color: var(--moss-dark);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Home: CSS 3D solar system ────────────────────────────────────────── */
.view.active[data-view-panel="home"] {
  position: relative;
  min-height: calc(100svh - 64px);
  padding: 0;
  overflow: hidden;
  isolation: isolate;
}

.cosmic-home {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse 72% 54% at 50% 44%, rgba(39, 55, 127, 0.16), transparent 65%),
    radial-gradient(ellipse 52% 32% at 18% 30%, rgba(128, 61, 184, 0.16), transparent 72%),
    linear-gradient(160deg, rgba(3, 4, 14, 0.46), rgba(6, 7, 25, 0.1));
}

.cosmic-home::before,
.cosmic-home::after {
  content: "";
  position: absolute;
  inset: -20%;
  pointer-events: none;
}

.cosmic-home::before {
  opacity: 0;
  background-image: radial-gradient(circle, rgba(233, 240, 255, 0.95) 0 1px, transparent 1.8px);
  background-size: 91px 97px;
  animation: starReveal 1.8s 0.15s ease-out forwards, starDrift 18s linear infinite;
}

.cosmic-home::after {
  background: radial-gradient(circle at 50% 48%, transparent 0 18%, rgba(1, 2, 10, 0.08) 47%, rgba(1, 2, 10, 0.68) 100%);
}

.cosmic-nebula {
  position: absolute;
  width: 56vmax;
  height: 29vmax;
  border-radius: 50%;
  filter: blur(34px);
  opacity: 0;
  animation: nebulaReveal 2.2s 0.4s ease-out forwards;
}

.nebula-one { top: 8%; left: -16%; background: rgba(92, 56, 209, 0.18); transform: rotate(-20deg); }
.nebula-two { right: -20%; bottom: 10%; background: rgba(40, 111, 210, 0.14); transform: rotate(22deg); animation-delay: 0.75s; }

.solar-stage {
  --scene-size: min(96vw, 1040px);
  position: absolute;
  top: 44%;
  left: 50%;
  width: var(--scene-size);
  height: calc(var(--scene-size) * 0.57);
  transform: translate(-50%, -50%);
  perspective: 1250px;
  perspective-origin: 50% 46%;
  transform-style: preserve-3d;
}

.solar-system {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  opacity: 0.08;
  filter: blur(10px);
  transform: scale(0.26) translateZ(-720px);
  transition: transform 1.9s cubic-bezier(0.12, 0.8, 0.18, 1), opacity 1.15s ease, filter 1.5s ease;
}

.solar-system.is-ready {
  opacity: 1;
  filter: blur(0);
  transform: scale(1) translateZ(0);
}

.orbit {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--orbit-size);
  height: calc(var(--orbit-size) * 0.52);
  border: 1px dashed rgba(180, 204, 255, 0.2);
  border-top-color: rgba(105, 130, 220, 0.08);
  border-bottom-color: rgba(195, 213, 255, 0.36);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(126, 158, 255, 0.12), inset 0 0 7px rgba(126, 158, 255, 0.05);
  transform: translate(-50%, -50%) rotateX(66deg);
  transform-style: preserve-3d;
  backface-visibility: visible;
}

.orbit-mercury { --orbit-size: 20%; }
.orbit-venus { --orbit-size: 29%; }
.orbit-earth { --orbit-size: 39%; }
.orbit-mars { --orbit-size: 50%; }
.orbit-jupiter { --orbit-size: 64%; }
.orbit-saturn { --orbit-size: 79%; }

.solar-sun {
  position: absolute;
  top: 50%;
  left: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  color: #fff7d4;
  background: radial-gradient(circle at 34% 28%, #fffdf1 0 4%, #ffd778 17%, #ff9b52 43%, #9e3f48 76%, #3c1949 100%);
  box-shadow: 0 0 20px rgba(255, 198, 103, 0.9), 0 0 58px rgba(255, 137, 91, 0.46), 0 0 120px rgba(170, 108, 255, 0.24), inset -12px -14px 20px rgba(76, 22, 54, 0.4), inset 7px 6px 12px rgba(255, 255, 239, 0.64);
  transform: translate3d(-50%, -50%, 0);
  transform-style: preserve-3d;
  animation: sunAwake 1.6s 1.05s both;
}

.sun-corona {
  position: absolute;
  inset: -28px;
  border: 1px solid rgba(255, 204, 132, 0.33);
  border-radius: inherit;
  box-shadow: 0 0 28px rgba(255, 165, 94, 0.3), inset 0 0 20px rgba(255, 205, 123, 0.14);
  animation: coronaPulse 5s ease-in-out infinite;
}

.home-logo {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: 38px;
  line-height: 1;
  filter: drop-shadow(0 2px 2px rgba(59, 15, 43, 0.45));
}

.sun-wordmark {
  position: absolute;
  top: calc(100% + 13px);
  font-family: "Noto Serif SC", serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: rgba(255, 238, 193, 0.9);
  text-shadow: 0 1px 10px rgba(255, 172, 100, 0.8);
}

.planet {
  --planet-size: 15px;
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--planet-size);
  height: var(--planet-size);
  border-radius: 50%;
  transform-style: preserve-3d;
  will-change: transform, opacity, filter;
  box-shadow: inset 7px -7px 10px rgba(0, 0, 0, 0.55), inset -3px 3px 7px rgba(255, 255, 255, 0.2), 0 0 8px rgba(170, 203, 255, 0.38);
  transition: opacity 1s ease var(--intro-delay);
}

.planet i {
  position: absolute;
  inset: 0;
  display: block;
  border-radius: inherit;
  overflow: hidden;
  opacity: 0.72;
  mix-blend-mode: screen;
  animation: planetSpin var(--spin-time) linear infinite;
}

.solar-system:not(.is-ready) .planet { opacity: 0; }
.solar-system.is-ready .planet { opacity: 1; }
.mercury { --planet-size: 11px; --spin-time: 20s; --intro-delay: 1.2s; background: radial-gradient(circle at 30% 27%, #ece0cc, #8d735d 43%, #241b24 88%); }
.venus { --planet-size: 16px; --spin-time: 25s; --intro-delay: 1.32s; background: radial-gradient(circle at 31% 25%, #fff3af, #d99b4c 43%, #693b36 88%); }
.earth { --planet-size: 20px; --spin-time: 18s; --intro-delay: 1.44s; background: radial-gradient(circle at 30% 25%, #c9f7ff, #2d91dc 34%, #185184 64%, #08182d 94%); }
.mars { --planet-size: 14px; --spin-time: 22s; --intro-delay: 1.56s; background: radial-gradient(circle at 30% 26%, #ffc08a, #ce5f3d 43%, #63262a 88%); }
.jupiter { --planet-size: 39px; --spin-time: 13s; --intro-delay: 1.68s; background: radial-gradient(circle at 31% 23%, #fff0d0, #dba46d 34%, #a8654e 62%, #472b31 94%); }
.saturn { --planet-size: 32px; --spin-time: 16s; --intro-delay: 1.8s; background: radial-gradient(circle at 31% 23%, #fff5c6, #e4bd71 38%, #b07753 66%, #4d3033 94%); }

.earth i { background: radial-gradient(ellipse at 18% 36%, rgba(105, 237, 180, 0.82) 0 13%, transparent 15%), radial-gradient(ellipse at 70% 56%, rgba(92, 213, 145, 0.7) 0 14%, transparent 16%), linear-gradient(80deg, transparent 20%, rgba(255,255,255,0.45) 47%, transparent 60%); }
.mars i { background: linear-gradient(35deg, transparent 42%, rgba(255, 205, 145, 0.35) 48%, transparent 55%); }
.jupiter i { background: repeating-linear-gradient(8deg, transparent 0 5px, rgba(111, 57, 44, 0.45) 6px 8px, rgba(255, 219, 165, 0.32) 9px 11px); }
.saturn i { background: repeating-linear-gradient(12deg, transparent 0 5px, rgba(126, 79, 50, 0.36) 6px 8px); }

.saturn-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: -1;
  width: 205%;
  height: 62%;
  border: 4px solid rgba(233, 203, 146, 0.78);
  border-top-color: rgba(163, 128, 111, 0.34);
  border-bottom-color: rgba(255, 238, 184, 0.9);
  border-radius: 50%;
  box-shadow: 0 0 7px rgba(255, 219, 153, 0.44);
  transform: translate(-50%, -50%) rotateX(66deg) rotateZ(-16deg);
}

.home-greeting {
  position: absolute;
  z-index: 10;
  bottom: clamp(36px, 9vh, 88px);
  left: 50%;
  width: max-content;
  max-width: calc(100% - 36px);
  padding: 11px 20px;
  color: #eef0ff;
  font-size: clamp(18px, 2.4vw, 28px);
  background: linear-gradient(135deg, rgba(255,255,255,0.14), rgba(255,255,255,0.045));
  border: 1px solid rgba(210, 221, 255, 0.24);
  border-radius: 999px;
  box-shadow: 0 10px 38px rgba(0, 0, 0, 0.26), inset 0 1px 0 rgba(255,255,255,0.28);
  backdrop-filter: blur(18px) saturate(150%);
  transform: translateX(-50%) translateY(14px);
  opacity: 0;
  animation: greetingIn 0.9s 2.15s ease-out forwards;
}

.app-header { position: relative; z-index: 50; }

@keyframes starReveal { to { opacity: 0.54; } }
@keyframes starDrift { to { transform: translate3d(-46px, 28px, 0); } }
@keyframes nebulaReveal { to { opacity: 1; } }
@keyframes sunAwake { 0% { opacity: 0; transform: translate3d(-50%, -50%, 0) scale(0.25); } 65% { opacity: 1; transform: translate3d(-50%, -50%, 0) scale(1.12); } 100% { transform: translate3d(-50%, -50%, 0) scale(1); } }
@keyframes coronaPulse { 50% { transform: scale(1.15); opacity: 0.42; } }
@keyframes planetSpin { to { transform: rotate(360deg); } }
@keyframes greetingIn { to { opacity: 1; transform: translateX(-50%) translateY(0); } }

@media (max-width: 600px) {
  .view.active[data-view-panel="home"] { min-height: calc(100svh - 50px); }
  .solar-stage { --scene-size: 116vw; top: 43%; perspective: 1050px; }
  .solar-sun { width: 76px; height: 76px; }
  .home-logo { font-size: 30px; }
  .sun-wordmark { font-size: 11px; top: calc(100% + 10px); }
  .planet { transform-origin: center; }
  .jupiter { --planet-size: 32px; }
  .saturn { --planet-size: 27px; }
  .home-greeting { bottom: max(32px, env(safe-area-inset-bottom)); padding: 9px 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .cosmic-home::before, .cosmic-nebula, .solar-sun, .sun-corona, .planet i, .home-greeting { animation: none; opacity: 1; }
  .solar-system { opacity: 1; filter: none; transform: none; transition: none; }
}

.view.active[data-view-panel="home"] {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  max-width: none;
  min-height: 0;
  padding-bottom: 10vh;
  overflow: visible;
  isolation: auto;
  pointer-events: none;
}

.home-logo {
  position: static;
  width: auto;
  height: auto;
  margin-bottom: 30px;
  font-size: 64px;
  line-height: 1;
  color: inherit;
  background: none;
  border-radius: 0;
  box-shadow: none;
  transform: none;
  animation: none;
  filter: none;
  position: relative;
  isolation: isolate;
}

.home-logo::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: 50%;
  left: 50%;
  width: 185px;
  height: 68px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(227, 178, 111, 0.18) 0%, rgba(187, 128, 90, 0.07) 42%, transparent 72%);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.home-logo img {
  display: block;
  position: relative;
  z-index: 1;
  width: 224px;
  height: 112px;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(203, 164, 105, 0.2));
}

.home-greeting {
  position: static;
  width: auto;
  max-width: none;
  margin: 0;
  padding: 0 12px;
  color: var(--moss-dark);
  font-size: clamp(18px, 5.2vw, 24px);
  font-weight: 600;
  line-height: 1.4;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  transform: none;
  opacity: 1;
  animation: none;
}

.view.active {
  display: block;
  /* Do not fade the entire view: backdrop-filter surfaces briefly lose their
     opaque glass layer during an ancestor opacity animation. */
  animation: none;
}

@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  position: relative;
  /* Layer 1 (top): glossy sheen gradient.  Layer 2: translucent tint.
     backdrop-filter blurs the cosmos behind → frosted-but-see-through. */
  background:
    linear-gradient(180deg, var(--card-glass-sheen) 0%, rgba(255, 255, 255, 0.045) 26%, transparent 54%),
    radial-gradient(ellipse 92% 64% at 0% 0%, rgba(158, 182, 255, 0.075), transparent 72%),
    var(--card-glass-base);
  backdrop-filter: blur(var(--card-glass-blur)) saturate(var(--card-glass-saturate));
  -webkit-backdrop-filter: blur(var(--card-glass-blur)) saturate(var(--card-glass-saturate));
  isolation: isolate;
  border: 1px solid var(--card-glass-border);
  border-radius: 22px;
  box-shadow: var(--card-glass-shadow);
  padding: 22px 20px 20px;
  width: 100%;
  margin-bottom: 22px;
  overflow: visible;
}

.card::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 1px;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(128deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.03) 28%, transparent 54%),
    linear-gradient(108deg, transparent 54%, var(--card-glass-refract-blue) 78%, transparent 100%),
    radial-gradient(ellipse 78% 30% at 50% 0%, rgba(226, 234, 255, 0.09), transparent 74%);
  box-shadow: inset 0 1px 0 var(--card-glass-top-rim), inset 1px 0 0 var(--card-glass-side-rim), inset 0 -1px 0 var(--card-glass-refract-violet);
}

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

.card:hover {
  border-color: rgba(241, 246, 255, 0.4);
  box-shadow: var(--card-glass-shadow), 0 24px 62px rgba(1, 4, 18, 0.26), 0 0 32px rgba(131, 155, 255, 0.08);
}

/* Activity is intentionally brighter and more open than the smoky sidebar.
   It reads as a light-catching content pane rather than navigation chrome. */
[data-view-panel="activity"] .card {
  background:
    linear-gradient(180deg, var(--card-glass-sheen) 0%, rgba(255, 255, 255, 0.045) 26%, transparent 54%),
    radial-gradient(ellipse 110% 76% at 0% 0%, rgba(154, 177, 255, 0.075), transparent 66%),
    var(--card-glass-base);
  border-color: var(--card-glass-border);
  backdrop-filter: blur(var(--card-glass-blur)) saturate(var(--card-glass-saturate));
  -webkit-backdrop-filter: blur(var(--card-glass-blur)) saturate(var(--card-glass-saturate));
  box-shadow: var(--card-glass-shadow);
}

.card h2,
.card .quote-text,
.entry-text,
.home-greeting,
.gate-card h1,
.message-bubble,
.article-entry p,
.article-entry h3 {
  text-shadow: var(--text-shadow);
}

.gate-card {
  max-width: 480px;
}

/* Forest leaf/vine decorations and the playful card tilt are dropped for the
   sleek cosmic-glass look. */

.gate-card {
  text-align: center;
  margin-top: 12vh;
}

.brand-mark {
  width: 142px;
  height: 72px;
  margin: 0 auto 8px;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 8px 17px rgba(206, 165, 105, 0.28));
}

.login-page .brand-mark {
  width: 118px;
  height: 60px;
  margin-bottom: 5px;
}

.login-page .gate-card h1 {
  font-size: 38px;
  letter-spacing: 0.8px;
}

/* 照片版本先注释，后面再启用
.brand-mark {
  width: 72px;
  height: 72px;
  margin: 0 auto 12px;
  border-radius: 50%;
  border: 3px solid var(--wood);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
*/

.gate-card h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--moss-dark);
  margin: 0 0 22px;
}

.subtitle {
  color: var(--subtitle);
  font-size: 14px;
  margin: 8px 0;
}

h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 14px;
  padding-bottom: 8px;
  color: var(--moss-dark);
  border-bottom: 2px dashed var(--border);
}

.section-icon {
  position: absolute;
  top: -18px;
  right: 16px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), inset 0 1px 0 var(--glass-highlight);
  transform: rotate(6deg);
}

/* 照片版本先注释，后面再启用
.section-icon {
  position: absolute;
  top: -18px;
  right: 16px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--morning-soft);
  border: 3px solid var(--wood);
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(69, 84, 58, 0.18);
  transform: rotate(6deg);
}

.section-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
*/

input, textarea {
  width: 100%;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 13px 14px;
  font-size: 16px;
  font-family: inherit;
  margin-bottom: 12px;
  resize: none;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.025) 42%, rgba(126, 146, 255, 0.05)),
    rgba(9, 12, 34, 0.22);
  backdrop-filter: blur(18px) saturate(170%);
  -webkit-backdrop-filter: blur(18px) saturate(170%);
  color: var(--text);
  /* top rim light + a gentle recess so fields read as inset glass */
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.33), inset 0 2px 14px rgba(0, 0, 0, 0.28), inset 0 -1px 0 rgba(129, 151, 236, 0.08);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input::placeholder, textarea::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--glass-sheen-grad), rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 1px 0 var(--glass-rim), 0 0 0 3px var(--accent-glow), 0 0 20px var(--accent-glow);
}

/* Primary action = luminous accent liquid-glass. Secondary buttons below
   re-style themselves (transparent / bordered), so this only "shines" on CTAs. */
button {
  border: 1px solid rgba(198, 212, 255, 0.48);
  border-radius: 15px;
  padding: 13px 20px;
  min-height: 48px;
  font-size: 16px;
  font-family: inherit;
  cursor: pointer;
  color: #f2f4ff;
  text-shadow: 0 1px 2px rgba(20, 24, 60, 0.5);
  /* sheen on top, accent tint below → glass with a colour of its own */
  background:
    linear-gradient(132deg, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0.08) 24%, transparent 48%),
    radial-gradient(ellipse 90% 70% at 20% 0%, rgba(220, 229, 255, 0.22), transparent 58%),
    linear-gradient(180deg, rgba(142, 162, 255, 0.34), rgba(96, 117, 223, 0.16));
  backdrop-filter: blur(30px) saturate(185%);
  -webkit-backdrop-filter: blur(30px) saturate(185%);
  box-shadow: 0 14px 30px rgba(7, 10, 38, 0.3), 0 8px 22px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.52), inset 0 -1px 0 rgba(92, 113, 210, 0.25);
  transition: background 0.24s ease, transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.24s ease, border-color 0.24s ease;
}

button:hover {
  background:
    linear-gradient(132deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0.1) 25%, transparent 50%),
    radial-gradient(ellipse 90% 70% at 20% 0%, rgba(231, 237, 255, 0.29), transparent 60%),
    linear-gradient(180deg, rgba(164, 181, 255, 0.44), rgba(105, 127, 234, 0.22));
  border-color: rgba(221, 230, 255, 0.7);
  box-shadow: 0 18px 34px rgba(7, 10, 38, 0.34), 0 12px 30px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.64);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0) scale(0.985);
  box-shadow: 0 7px 16px rgba(7, 10, 38, 0.32), 0 4px 14px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Transparent utility buttons shouldn't carry the primary button's backdrop
   blur (it would smear a faint rectangle behind them). */
.nav-item,
.mood-btn,
.space-exit-btn,
.friend-row-clickable,
.voice-record-btn,
.back-btn {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

#login-form button, #register-form button {
  width: 100%;
}

a {
  color: var(--wood-dark);
}

.error {
  color: var(--danger);
  font-size: 13px;
}

.success {
  color: var(--success);
  font-size: 13px;
}

.logout-button {
  width: 100%;
  background: transparent;
  color: var(--danger);
  border: 1.5px solid rgba(255, 143, 160, 0.5);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.logout-button:hover {
  background: rgba(255, 143, 160, 0.1);
  border-color: var(--danger);
}

.logout-button:active {
  transform: translateY(1px);
  box-shadow: none;
}

.back-btn {
  display: inline-block;
  width: auto;
  background: transparent;
  color: var(--subtitle);
  border: none;
  box-shadow: none;
  padding: 4px 0;
  min-height: auto;
  font-size: 13px;
  text-decoration: underline;
  margin-bottom: 10px;
}

.back-btn:hover {
  background: transparent;
  color: var(--wood-dark);
}

.back-btn:active {
  transform: none;
  box-shadow: none;
}

.friend-row-clickable {
  width: 100%;
  font-family: inherit;
  font-size: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: none;
  min-height: auto;
}

.friend-row-clickable:hover {
  border-color: var(--wood);
}

.friend-row-clickable:active {
  transform: none;
  box-shadow: none;
}

.friend-search-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.friend-search-row input {
  flex: 1;
}

.friend-search-row button {
  flex-shrink: 0;
  width: auto;
}

.friend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.friend-username {
  font-weight: 600;
  color: var(--text);
}

.friend-hint {
  font-size: 12.5px;
  color: var(--subtitle);
}

.friend-row-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.friend-action-btn,
.friend-accept-btn,
.friend-decline-btn {
  width: auto;
  min-height: auto;
  padding: 7px 14px;
  font-size: 13px;
  box-shadow: none;
}

.friend-action-btn:disabled {
  background: var(--border);
  color: var(--subtitle);
  cursor: default;
}

.friend-decline-btn {
  background: transparent;
  color: var(--danger);
  border: 1.5px solid rgba(255, 143, 160, 0.5);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
}

.friend-decline-btn:hover {
  background: rgba(255, 143, 160, 0.1);
  border-color: var(--danger);
}

.friend-decline-btn:active {
  transform: translateY(1px);
}

.empty-hint {
  color: var(--subtitle);
  font-size: 13px;
  text-align: center;
  padding: 10px 0;
}

.app-header {
  width: 100%;
  padding: 4px 4px 20px;
  font-size: 15px;
  color: var(--subtitle);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.mood-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
  gap: 12px 6px;
  margin-bottom: 14px;
}

.mood-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 4px 0;
  min-height: auto;
  color: var(--subtitle);
}

.mood-btn:hover {
  background: transparent;
}

.mood-btn:active {
  transform: none;
  box-shadow: none;
}

.animal-frame {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--card-alt);
  border: 2px dashed var(--wood);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  transition: box-shadow 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.mood-btn.selected .animal-frame {
  background: var(--accent-soft);
  border-style: solid;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow), 0 0 18px var(--accent-glow);
  transform: scale(1.06);
}

/* 照片版本先注释，后面再启用
.animal-frame {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--card-alt);
  border: 3px solid var(--wood);
  overflow: hidden;
  transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.animal-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mood-btn.selected .animal-frame {
  border-color: var(--morning);
  box-shadow: 0 0 0 3px rgba(227, 169, 76, 0.35);
  transform: scale(1.06);
}
*/

.mood-label {
  font-size: 12px;
  color: var(--subtitle);
  text-align: center;
  line-height: 1.2;
}

.mood-btn.selected .mood-label {
  color: var(--moss-dark);
  font-weight: 600;
}

.voice-recorder {
  margin-bottom: 12px;
}

.image-uploader {
  margin-bottom: 12px;
}

.image-upload-btn {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 9px 16px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--wood-dark);
  text-align: center;
  font-size: 14px;
  cursor: pointer;
}

.image-upload-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.image-preview {
  position: relative;
  margin-top: 10px;
}

.image-preview img,
.entry-image {
  display: block;
  max-width: 100%;
  max-height: 260px;
  border: 1px solid var(--border);
  border-radius: 8px;
  object-fit: contain;
}

.image-discard-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 32px;
  height: 32px;
  min-height: auto;
  padding: 0;
  border-radius: 50%;
  background: rgba(10, 9, 26, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--danger);
  border: 1px solid var(--glass-border);
  box-shadow: none;
}

.voice-record-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  justify-content: center;
  background: transparent;
  color: var(--wood-dark);
  border: 1.5px solid var(--border);
  box-shadow: none;
  padding: 9px 16px;
  min-height: auto;
  font-size: 14px;
  touch-action: none;
  user-select: none;
}

.voice-record-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.voice-record-btn:active {
  transform: none;
  box-shadow: none;
}

.voice-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 8px var(--danger);
  flex-shrink: 0;
}

.voice-record-btn.recording {
  border-color: var(--danger);
  color: var(--danger);
}

.voice-record-btn.recording .voice-dot {
  animation: voicePulse 1s ease-in-out infinite;
}

@keyframes voicePulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.4;
    transform: scale(1.4);
  }
}

.entry-voice {
  display: block;
  width: 100%;
  height: 40px;
  margin-top: 8px;
}

.entry-image {
  margin-top: 8px;
}

.list {
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.entry {
  padding: 10px 12px;
  border-radius: 6px 14px 6px 14px;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.018) 52%), rgba(5, 8, 24, 0.25);
  border: 1px solid rgba(219, 228, 255, 0.16);
  backdrop-filter: blur(15px) saturate(155%);
  -webkit-backdrop-filter: blur(15px) saturate(155%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.17), inset 0 -1px 0 rgba(124, 145, 233, 0.08);
}

.entry-meta {
  font-size: 12.5px;
  color: var(--subtitle);
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
}

.entry-mood {
  font-size: 22px;
  margin-right: 6px;
}

.entry-text {
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.message-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.message-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 6px 14px 14px 14px;
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.message-bubble.from-me {
  align-self: flex-end;
  background: linear-gradient(180deg, rgba(142, 162, 255, 0.32), rgba(142, 162, 255, 0.18));
  border: 1px solid rgba(142, 162, 255, 0.4);
  color: #f2f4ff;
  border-radius: 14px 6px 14px 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.33), 0 8px 20px rgba(9, 12, 39, 0.16);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
}

.message-bubble.from-them {
  align-self: flex-start;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)), rgba(5, 8, 24, 0.26);
  border: 1px solid rgba(219, 228, 255, 0.18);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 8px 20px rgba(9, 12, 39, 0.13);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
}

.message-time {
  font-size: 11px;
  opacity: 0.75;
  margin-top: 2px;
}

.writing-card {
  margin-top: 18px;
}

/* Diary: My / Their tab switch — a glass segmented control */
.diary-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
}

.diary-tab {
  flex: 1;
  width: auto;
  min-height: auto;
  padding: 9px 10px;
  font-size: 14px;
  border-radius: 10px;
  color: var(--subtitle);
  background: transparent;
  border: 1px solid transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  text-shadow: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.diary-tab:hover {
  background: rgba(255, 255, 255, 0.06);
}

.diary-tab.active {
  color: #f2f4ff;
  background: var(--glass-sheen-grad),
    linear-gradient(180deg, rgba(142, 162, 255, 0.28), rgba(142, 162, 255, 0.1));
  border-color: rgba(160, 178, 255, 0.42);
  box-shadow: inset 0 1px 0 var(--glass-rim), 0 4px 14px var(--accent-glow);
}

#diary-composer {
  margin-bottom: 4px;
}

.suggestion-image-uploader {
  margin-bottom: 12px;
}

.suggestion-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 460px;
  overflow-y: auto;
}

.suggestion-entry {
  padding: 14px;
  border: 1px solid rgba(219, 228, 255, 0.16);
  border-radius: 10px 16px 10px 16px;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.018) 56%), rgba(5, 8, 24, 0.25);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.17), inset 0 -1px 0 rgba(124, 145, 233, 0.08);
  backdrop-filter: blur(15px) saturate(155%);
  -webkit-backdrop-filter: blur(15px) saturate(155%);
}

.suggestion-entry > p {
  margin: 0;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.suggestion-entry-image {
  display: block;
  max-width: 100%;
  max-height: 260px;
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  object-fit: contain;
}

.suggestion-entry-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  color: var(--subtitle);
  font-size: 12px;
}

.suggestion-delete-btn {
  width: auto;
  min-height: 30px;
  padding: 5px 10px;
  border-color: rgba(255, 143, 160, 0.35);
  background: rgba(255, 143, 160, 0.06);
  box-shadow: none;
  color: var(--danger);
  font-size: 12px;
}

.suggestion-delete-btn:hover {
  background: rgba(255, 143, 160, 0.12);
  border-color: rgba(255, 143, 160, 0.58);
  box-shadow: none;
}

.article-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 460px;
  margin-top: 18px;
  overflow-y: auto;
}

.article-entry {
  padding: 14px;
  border: 1px solid rgba(219, 228, 255, 0.16);
  border-radius: 8px 16px 8px 16px;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.018) 56%), rgba(5, 8, 24, 0.25);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.17), inset 0 -1px 0 rgba(124, 145, 233, 0.08);
  backdrop-filter: blur(15px) saturate(155%);
  -webkit-backdrop-filter: blur(15px) saturate(155%);
}

.article-entry h3 {
  margin: 0 0 8px;
  color: var(--wood-dark);
  font-size: 17px;
}

.article-entry p {
  margin: 0;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.article-meta {
  margin-top: 10px !important;
  color: var(--subtitle);
  font-size: 12px;
}

.credits {
  width: 100%;
  max-width: 480px;
  margin-top: 8px;
  padding: 0 8px;
  font-size: 11px;
  line-height: 1.7;
  color: var(--subtitle);
  text-align: center;
  opacity: 0.8;
}

.credits a {
  color: var(--subtitle);
  text-decoration: underline;
}

/* 电脑版（宽屏）：侧边栏常驻显示，不再是可收起的抽屉 */
/* The realistic Saturn has a wider visual footprint than an emoji. On mobile,
   reserve a dedicated brand zone so its rings cannot visually touch the first
   navigation control. */
@media (max-width: 767px) {
  @supports (height: 100dvh) {
    #app-screen.screen,
    .app-shell {
      height: 100dvh;
      min-height: 0;
    }

    .content-area {
      min-height: 0;
      overflow-y: auto;
      overscroll-behavior-y: contain;
    }
  }

  #app-screen.screen,
  .app-shell {
    height: var(--app-viewport-height);
  }

  .sidebar {
    height: var(--app-viewport-height);
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }

  .content-area {
    padding: 12px 12px calc(14px + env(safe-area-inset-bottom));
  }

  .app-header {
    padding: 2px 2px 10px;
  }

  .sidebar-brand {
    min-height: 92px;
    padding-bottom: 24px;
  }

  .sidebar .menu-group {
    padding-top: 8px;
  }

}

@media (min-width: 768px) {
  .app-shell {
    flex-direction: row;
  }

  .sidebar {
    position: sticky;
    top: 0;
    left: auto;
    height: 100vh;
    width: 224px;
    max-width: none;
    flex-shrink: 0;
    transform: none;
    background:
      linear-gradient(145deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.025) 18%, transparent 42%),
      radial-gradient(ellipse 86% 55% at 0% 0%, rgba(113, 137, 219, 0.13), transparent 70%),
      rgba(8, 14, 37, 0.72);
    border-right-color: rgba(220, 230, 255, 0.08);
    box-shadow: 10px 0 34px rgba(0, 0, 0, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.28), inset 1px 0 0 rgba(255, 255, 255, 0.12), inset -1px 0 0 rgba(138, 160, 226, 0.09);
  }

  @supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
    .sidebar {
      background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.13) 0%, rgba(255, 255, 255, 0.02) 18%, transparent 42%),
        radial-gradient(ellipse 86% 55% at 0% 0%, rgba(113, 137, 219, 0.14), transparent 70%),
        rgba(8, 14, 37, 0.46);
      backdrop-filter: blur(34px) saturate(155%);
      -webkit-backdrop-filter: blur(34px) saturate(155%);
    }
  }

  .sidebar::before {
    background: linear-gradient(112deg, rgba(255, 255, 255, 0.14), transparent 20% 78%, rgba(142, 165, 231, 0.045));
    opacity: 0.72;
  }

  .sidebar #hall-menu .nav-item {
    gap: 11px;
    min-height: 42px;
    padding: 10px 12px;
    color: rgba(222, 226, 241, 0.64);
    background: transparent;
    border-color: transparent;
    box-shadow: none;
  }

  .sidebar #hall-menu .nav-icon {
    display: none;
  }

  .sidebar #hall-menu .nav-icon-lucide {
    display: block;
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.72;
  }

  .sidebar #hall-menu .nav-item:hover {
    color: rgba(244, 246, 255, 0.86);
    background: linear-gradient(128deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.018));
    border-color: transparent;
    box-shadow: none;
  }

  .sidebar #hall-menu .nav-item.active {
    position: relative;
    isolation: isolate;
    color: rgba(248, 249, 255, 0.94);
    background:
      radial-gradient(110px 54px at calc(50% + var(--liquid-x, 0px)) calc(26% + var(--liquid-y, 0px)), rgba(255, 255, 255, 0.2), transparent 68%),
      linear-gradient(135deg, rgba(255, 255, 255, 0.14), rgba(178, 194, 242, 0.055) 46%, rgba(255, 255, 255, 0.025)),
      rgba(92, 114, 183, 0.12);
    border-color: rgba(235, 242, 255, 0.13);
    box-shadow: 0 8px 18px rgba(1, 5, 22, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.34), inset 0 -1px 0 rgba(160, 181, 239, 0.1);
    backdrop-filter: blur(16px) saturate(145%);
    -webkit-backdrop-filter: blur(16px) saturate(145%);
  }

  .sidebar #hall-menu .nav-item.active::before {
    content: "";
    position: absolute;
    left: 3px;
    top: 12px;
    bottom: 12px;
    width: 1px;
    border-radius: 99px;
    background: rgba(235, 240, 255, 0.42);
    z-index: 2;
  }

  .sidebar #hall-menu .nav-item.active > * {
    position: relative;
    z-index: 1;
  }

  .sidebar #hall-menu .nav-item.active .nav-icon-lucide {
    opacity: 0.94;
  }

  .sidebar #hall-menu .nav-item:focus-visible {
    outline: 2px solid rgba(214, 225, 255, 0.55);
    outline-offset: 2px;
  }

  .sidebar-toggle,
  .sidebar-overlay {
    display: none;
  }

  .content-area {
    padding: 36px 44px 48px;
  }

  .list {
    max-height: 420px;
  }
}
