:root {
  /* —— Velvet burgundy / deep wine (landing / login / hub / dashboard) —— */
  --cosmos: #0a0608;
  --cosmos-deep: #050304;
  --bg: var(--cosmos);
  --text: #f0e6e2;
  --text-muted: #8a7578;
  /* Velvet = wine depth; accent = dusty rose-champagne (not purple, not neon) */
  --velvet: rgba(92, 28, 44, 1);
  --velvet-rgb: 92, 28, 44;
  --velvet-lift-rgb: 118, 44, 62;
  --velvet-deep-rgb: 22, 6, 12;
  --accent: #c9a090;
  --accent-rgb: 201, 160, 144;
  --accent-soft: #ecd4ca;
  --accent-dim: rgba(var(--accent-rgb), 0.1);
  --accent-line: rgba(var(--accent-rgb), 0.34);
  --accent-glow: rgba(var(--accent-rgb), 0.14);
  --accent-btn-top: #d8b5a8;
  --accent-btn-bot: #c9a090;
  --accent-btn-hover-top: #e0c4b8;
  --accent-btn-hover-bot: #cfa08f;
  --accent-on: #1a0c10;
  --surface: rgba(16, 8, 11, 0.9);
  --surface-elevated: rgba(26, 12, 16, 0.94);
  --surface-panel: rgba(24, 12, 16, 0.68);
  --surface-panel-deep: rgba(10, 4, 8, 0.86);
  --surface-border: rgba(255, 255, 255, 0.08);
  --surface-border-strong: rgba(var(--accent-rgb), 0.24);
  --hub-bg: var(--cosmos);
  --hub-elevated: #160c10;
  --hub-card: rgba(22, 10, 14, 0.92);
  --hub-border: rgba(255, 255, 255, 0.07);
  --hub-border-strong: rgba(var(--accent-rgb), 0.4);
  --hub-text: #f0e6e2;
  --hub-muted: #947e82;
  --danger-text: #d4b0a4;
  --danger-bg: rgba(48, 22, 24, 0.65);
  --danger-border: rgba(140, 80, 78, 0.35);
  --ok-text: #9eb8a4;
  --ok-bg: rgba(100, 140, 110, 0.14);
  --ok-border: rgba(100, 140, 110, 0.35);
  --font-display: "Instrument Serif", Georgia, serif;
  --font-body: "DM Sans", system-ui, sans-serif;
}

/*
 * Gate app (hub / login / dashboard): graphite + warm brass.
 * Landing (.page-landing) restores the pre-burgundy moon splash tokens below —
 * do not apply this graphite block to .page-landing.
 */
.page-hub,
.page-login,
.page-dash {
  --cosmos: #080a0e;
  --cosmos-deep: #040506;
  --bg: var(--cosmos);
  --text: #ebe6dc;
  --text-muted: #8a867c;
  --velvet: rgba(58, 52, 42, 1);
  --velvet-rgb: 58, 52, 42;
  --velvet-lift-rgb: 90, 78, 58;
  --velvet-deep-rgb: 10, 12, 16;
  --accent: #c4a574;
  --accent-rgb: 196, 165, 116;
  --accent-soft: #e4d4b4;
  --accent-dim: rgba(var(--accent-rgb), 0.1);
  --accent-line: rgba(var(--accent-rgb), 0.34);
  --accent-glow: rgba(var(--accent-rgb), 0.14);
  --accent-btn-top: #d4b888;
  --accent-btn-bot: #c4a574;
  --accent-btn-hover-top: #dfc698;
  --accent-btn-hover-bot: #c9ad7e;
  --accent-on: #14110c;
  --surface: rgba(12, 14, 18, 0.9);
  --surface-elevated: rgba(18, 20, 26, 0.94);
  --surface-panel: rgba(16, 18, 24, 0.68);
  --surface-panel-deep: rgba(6, 8, 12, 0.86);
  --surface-border: rgba(255, 255, 255, 0.08);
  --surface-border-strong: rgba(var(--accent-rgb), 0.24);
  --hub-bg: var(--cosmos);
  --hub-elevated: #12151c;
  --hub-card: rgba(14, 16, 22, 0.92);
  --hub-border: rgba(255, 255, 255, 0.07);
  --hub-border-strong: rgba(var(--accent-rgb), 0.4);
  --hub-text: #ebe6dc;
  --hub-muted: #8f8a7e;
  --danger-text: #d4b0a4;
  --danger-bg: rgba(48, 28, 24, 0.65);
  --danger-border: rgba(140, 90, 78, 0.35);
  --ok-text: #9eb8a4;
  --ok-bg: rgba(100, 140, 110, 0.14);
  --ok-border: rgba(100, 140, 110, 0.35);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100dvh;
  color: var(--text);
  font-family: var(--font-body);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* —— Shared page shell (landing / login / hub) —— */

.page-cosmos {
  position: relative;
  isolation: isolate;
  overflow-x: hidden;
  min-height: 100dvh;
  /* Solid dark field only — no page wash / veil / vignette */
  background: var(--cosmos);
  padding:
    env(safe-area-inset-top, 0)
    env(safe-area-inset-right, 0)
    env(safe-area-inset-bottom, 0)
    env(safe-area-inset-left, 0);
}

.atmosphere {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

/* Velvet depth field — burgundy glow / haze / vignette (not flat black) */
.atmosphere__glow {
  position: absolute;
  inset: -20% -10% auto -10%;
  height: 70%;
  background:
    radial-gradient(
      ellipse 70% 55% at 50% 0%,
      rgba(var(--velvet-lift-rgb), 0.38) 0%,
      rgba(var(--velvet-rgb), 0.18) 42%,
      transparent 72%
    );
  opacity: 0.95;
}

.atmosphere__haze {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      ellipse 90% 60% at 18% 88%,
      rgba(var(--velvet-rgb), 0.22) 0%,
      transparent 55%
    ),
    radial-gradient(
      ellipse 70% 50% at 88% 30%,
      rgba(var(--velvet-lift-rgb), 0.12) 0%,
      transparent 50%
    );
}

.atmosphere__spill {
  position: absolute;
  left: 50%;
  top: 8%;
  width: min(52rem, 90vw);
  height: min(28rem, 55vh);
  transform: translateX(-50%);
  background:
    radial-gradient(
      circle at 50% 40%,
      rgba(var(--accent-rgb), 0.09) 0%,
      rgba(var(--velvet-rgb), 0.14) 35%,
      transparent 70%
    );
  filter: blur(28px);
  opacity: 0.85;
}

.atmosphere__vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      ellipse 85% 75% at 50% 45%,
      transparent 40%,
      rgba(5, 3, 4, 0.55) 100%
    );
  opacity: 0.9;
}

.atmosphere__grain {
  position: absolute;
  inset: 0;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  mix-blend-mode: soft-light;
}

@keyframes atm-enter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Shared glass / velvet surface — material depth, not environment blobs */
.surface {
  position: relative;
  border: 1px solid var(--surface-border-strong);
  background:
    linear-gradient(
      165deg,
      rgba(38, 18, 24, 0.55) 0%,
      rgba(22, 10, 14, 0.72) 38%,
      rgba(12, 6, 8, 0.88) 100%
    );
  backdrop-filter: blur(28px) saturate(1.18);
  -webkit-backdrop-filter: blur(28px) saturate(1.18);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.085) inset,
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 -1px 0 rgba(var(--velvet-rgb), 0.28) inset,
    0 1px 1px rgba(255, 255, 255, 0.04),
    0 12px 28px rgba(0, 0, 0, 0.38),
    0 28px 56px rgba(0, 0, 0, 0.48),
    0 48px 96px rgba(var(--velvet-deep-rgb), 0.35),
    0 0 0 1px rgba(var(--velvet-rgb), 0.06);
}

.surface::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(180deg, transparent 52%, rgba(var(--velvet-rgb), 0.12) 100%),
    linear-gradient(
      118deg,
      rgba(255, 255, 255, 0.09) 0%,
      rgba(255, 255, 255, 0.03) 18%,
      transparent 42%,
      transparent 100%
    );
}

.surface::after {
  content: "";
  position: absolute;
  top: 0;
  left: 8%;
  right: 8%;
  height: 1px;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.22) 35%,
    rgba(255, 255, 255, 0.1) 65%,
    transparent 100%
  );
  opacity: 0.85;
}

/* —— Landing (hero density) ——
 * Restore pre-burgundy moon splash contrast (initial commit look).
 * Hub/login/dash keep their own tokens; moon + starfield markup untouched.
 */
.page-landing {
  --cosmos: #020203;
  --cosmos-deep: #010101;
  --bg: var(--cosmos);
  --text: #ebe8e2;
  --text-muted: #7a7f8c;
  --velvet: rgba(42, 58, 92, 1);
  --velvet-rgb: 42, 58, 92;
  --velvet-lift-rgb: 70, 88, 130;
  --velvet-deep-rgb: 18, 24, 40;
  --accent: #c4a574;
  --accent-rgb: 196, 165, 116;
  --accent-soft: #e6d3b0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--cosmos);
}

/* Flat dark ground — burgundy atmosphere washes out moon + brand */
.page-landing .atmosphere__glow,
.page-landing .atmosphere__haze,
.page-landing .atmosphere__spill,
.page-landing .atmosphere__vignette,
.page-landing .atmosphere__grain {
  display: none;
}

.page-hub .atmosphere__glow,
.page-login .atmosphere__glow,
.page-dash .atmosphere__glow {
  opacity: 1;
  background:
    radial-gradient(
      ellipse 70% 50% at 30% 0%,
      rgba(var(--velvet-lift-rgb), 0.36) 0%,
      rgba(var(--velvet-rgb), 0.16) 45%,
      transparent 75%
    );
}

.page-hub .hub-card.surface {
  background:
    linear-gradient(
      165deg,
      rgba(36, 34, 28, 0.58) 0%,
      rgba(16, 18, 24, 0.88) 52%,
      rgba(8, 10, 14, 0.94) 100%
    );
}

.page-landing .landing-center {
  animation: atm-enter 0.85s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

.btn-login {
  position: fixed;
  top: max(1rem, env(safe-area-inset-top, 0px));
  right: max(1rem, env(safe-area-inset-right, 0px));
  z-index: 20;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0.4rem 0.95rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(242, 242, 242, 0.88);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-transform: none;
  box-shadow: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.btn-login:hover {
  background: rgba(var(--accent-rgb), 0.12);
  border-color: rgba(var(--accent-rgb), 0.4);
  color: var(--accent-soft);
  box-shadow: 0 8px 24px rgba(var(--accent-rgb), 0.1);
}

.btn-login:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb), 0.55);
  outline-offset: 3px;
}

.starfield {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.landing-center {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: 0 1rem 2rem;
  text-align: center;
  animation: atm-enter 0.9s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

@media (min-width: 640px) {
  .landing-center {
    gap: 2rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

.moon-wrap {
  position: relative;
  width: 9rem;
  height: 9rem;
  border-radius: 9999px;
}

@media (min-width: 640px) {
  .moon-wrap {
    width: 12rem;
    height: 12rem;
  }
}

@media (min-width: 768px) {
  .moon-wrap {
    width: 14rem;
    height: 14rem;
  }
}

.brand-mark {
  margin: 0;
  color: #f2f2f2;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-shadow: none;
  user-select: none;
}

@media (min-width: 640px) {
  .brand-mark {
    font-size: 1.125rem;
    letter-spacing: 0.18em;
  }
}

@media (min-width: 768px) {
  .brand-mark {
    font-size: 1.25rem;
  }
}

/* Static moon (gray body + velvet glow) */

.static-moon {
  position: relative;
  width: 100%;
  height: 100%;
}

.moon-halo {
  position: absolute;
  inset: -18%;
  border-radius: 9999px;
  background: radial-gradient(
    circle,
    rgba(var(--velvet-rgb), 0.11) 0%,
    rgba(var(--velvet-rgb), 0.04) 38%,
    transparent 68%
  );
  filter: blur(12px);
  opacity: 0.7;
}

.moon-body {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 9999px;
  overflow: hidden;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.14) 0%, transparent 42%),
    radial-gradient(circle at 68% 72%, rgba(0, 0, 0, 0.45) 0%, transparent 48%),
    radial-gradient(circle at 38% 36%, #6e6c68 0%, #3a3937 32%, #1c1b1a 58%, #0e0e0e 100%);
  box-shadow:
    inset -18px -14px 48px rgba(0, 0, 0, 0.65),
    inset 10px 8px 28px rgba(255, 255, 255, 0.05),
    0 0 80px rgba(var(--velvet-rgb), 0.1),
    0 0 140px rgba(var(--velvet-rgb), 0.05);
}

.moon-crater {
  position: absolute;
  border-radius: 9999px;
}

.moon-crater--1 {
  width: 22%;
  height: 22%;
  top: 20%;
  left: 54%;
  background: radial-gradient(circle at 40% 35%, rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0.55) 70%);
  box-shadow: inset 2px 2px 8px rgba(0, 0, 0, 0.4);
}

.moon-crater--2 {
  width: 14%;
  height: 14%;
  top: 50%;
  left: 26%;
  background: radial-gradient(circle at 35% 30%, rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 0.45) 75%);
}

.moon-crater--3 {
  width: 9%;
  height: 9%;
  top: 66%;
  left: 60%;
  background: radial-gradient(circle, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.2) 100%);
}

.moon-crater--4 {
  width: 7%;
  height: 7%;
  top: 36%;
  left: 16%;
  background: radial-gradient(circle, rgba(0, 0, 0, 0.4) 0%, transparent 80%);
}

.moon-crater--5 {
  width: 5%;
  height: 5%;
  top: 28%;
  left: 38%;
  background: radial-gradient(circle, rgba(0, 0, 0, 0.35) 0%, transparent 85%);
}

.moon-terminator {
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  background: linear-gradient(115deg, transparent 42%, rgba(0, 0, 0, 0.55) 78%, rgba(0, 0, 0, 0.75) 100%);
}

.moon-rim {
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  pointer-events: none;
  box-shadow:
    inset 0 0 0 1px rgba(var(--accent-rgb), 0.2),
    0 0 24px rgba(var(--accent-rgb), 0.07);
}

/* Starfield animations (ported from MoonLanding) */

@keyframes star-twinkle {
  0%,
  100% {
    opacity: var(--star-alpha);
    transform: scale(1);
  }
  42% {
    opacity: calc(var(--star-alpha) * 0.18);
    transform: scale(0.88);
  }
  58% {
    opacity: calc(var(--star-alpha) * 1.08);
    transform: scale(var(--twinkle-scale, 1.2));
  }
}

@-webkit-keyframes star-twinkle {
  0%,
  100% {
    opacity: var(--star-alpha);
    -webkit-transform: scale(1);
    transform: scale(1);
  }
  42% {
    opacity: calc(var(--star-alpha) * 0.18);
    -webkit-transform: scale(0.88);
    transform: scale(0.88);
  }
  58% {
    opacity: calc(var(--star-alpha) * 1.08);
    -webkit-transform: scale(var(--twinkle-scale, 1.2));
    transform: scale(var(--twinkle-scale, 1.2));
  }
}

.star-twinkle {
  transform-origin: center;
  -webkit-animation: star-twinkle var(--twinkle-dur, 4s) ease-in-out infinite;
  animation: star-twinkle var(--twinkle-dur, 4s) ease-in-out infinite;
  -webkit-animation-delay: var(--twinkle-delay, 0s);
  animation-delay: var(--twinkle-delay, 0s);
}

@keyframes star-layer-drift-0 {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  25% {
    transform: translate3d(32px, -22px, 0);
  }
  50% {
    transform: translate3d(-14px, 36px, 0);
  }
  75% {
    transform: translate3d(-38px, 10px, 0);
  }
}

@keyframes star-layer-drift-1 {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  20% {
    transform: translate3d(-42px, 28px, 0);
  }
  45% {
    transform: translate3d(24px, -48px, 0);
  }
  70% {
    transform: translate3d(52px, 18px, 0);
  }
}

@keyframes star-layer-drift-2 {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  30% {
    transform: translate3d(58px, -36px, 0);
  }
  55% {
    transform: translate3d(-32px, 62px, 0);
  }
  80% {
    transform: translate3d(-68px, -20px, 0);
  }
}

@keyframes star-layer-drift-mobile-0 {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  25% {
    transform: translate3d(72px, -48px, 0);
  }
  50% {
    transform: translate3d(-36px, 80px, 0);
  }
  75% {
    transform: translate3d(-88px, 24px, 0);
  }
}

@keyframes star-layer-drift-mobile-1 {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  20% {
    transform: translate3d(-90px, 56px, 0);
  }
  45% {
    transform: translate3d(52px, -96px, 0);
  }
  70% {
    transform: translate3d(110px, 36px, 0);
  }
}

@keyframes star-layer-drift-mobile-2 {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  30% {
    transform: translate3d(120px, -72px, 0);
  }
  55% {
    transform: translate3d(-64px, 124px, 0);
  }
  80% {
    transform: translate3d(-140px, -40px, 0);
  }
}

@-webkit-keyframes star-layer-drift-0 {
  0%,
  100% {
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
  }
  25% {
    -webkit-transform: translate3d(32px, -22px, 0);
    transform: translate3d(32px, -22px, 0);
  }
  50% {
    -webkit-transform: translate3d(-14px, 36px, 0);
    transform: translate3d(-14px, 36px, 0);
  }
  75% {
    -webkit-transform: translate3d(-38px, 10px, 0);
    transform: translate3d(-38px, 10px, 0);
  }
}

@-webkit-keyframes star-layer-drift-1 {
  0%,
  100% {
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
  }
  20% {
    -webkit-transform: translate3d(-42px, 28px, 0);
    transform: translate3d(-42px, 28px, 0);
  }
  45% {
    -webkit-transform: translate3d(24px, -48px, 0);
    transform: translate3d(24px, -48px, 0);
  }
  70% {
    -webkit-transform: translate3d(52px, 18px, 0);
    transform: translate3d(52px, 18px, 0);
  }
}

@-webkit-keyframes star-layer-drift-2 {
  0%,
  100% {
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
  }
  30% {
    -webkit-transform: translate3d(58px, -36px, 0);
    transform: translate3d(58px, -36px, 0);
  }
  55% {
    -webkit-transform: translate3d(-32px, 62px, 0);
    transform: translate3d(-32px, 62px, 0);
  }
  80% {
    -webkit-transform: translate3d(-68px, -20px, 0);
    transform: translate3d(-68px, -20px, 0);
  }
}

@-webkit-keyframes star-layer-drift-mobile-0 {
  0%,
  100% {
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
  }
  25% {
    -webkit-transform: translate3d(72px, -48px, 0);
    transform: translate3d(72px, -48px, 0);
  }
  50% {
    -webkit-transform: translate3d(-36px, 80px, 0);
    transform: translate3d(-36px, 80px, 0);
  }
  75% {
    -webkit-transform: translate3d(-88px, 24px, 0);
    transform: translate3d(-88px, 24px, 0);
  }
}

@-webkit-keyframes star-layer-drift-mobile-1 {
  0%,
  100% {
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
  }
  20% {
    -webkit-transform: translate3d(-90px, 56px, 0);
    transform: translate3d(-90px, 56px, 0);
  }
  45% {
    -webkit-transform: translate3d(52px, -96px, 0);
    transform: translate3d(52px, -96px, 0);
  }
  70% {
    -webkit-transform: translate3d(110px, 36px, 0);
    transform: translate3d(110px, 36px, 0);
  }
}

@-webkit-keyframes star-layer-drift-mobile-2 {
  0%,
  100% {
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
  }
  30% {
    -webkit-transform: translate3d(120px, -72px, 0);
    transform: translate3d(120px, -72px, 0);
  }
  55% {
    -webkit-transform: translate3d(-64px, 124px, 0);
    transform: translate3d(-64px, 124px, 0);
  }
  80% {
    -webkit-transform: translate3d(-140px, -40px, 0);
    transform: translate3d(-140px, -40px, 0);
  }
}

.star-layer {
  position: absolute;
  inset: -6%;
}

@media (hover: none), (pointer: coarse) {
  .star-layer {
    inset: -14%;
  }
}

.star-layer-parallax {
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

@media (hover: hover) {
  .star-layer-parallax {
    translate: var(--parallax-x, 0px) var(--parallax-y, 0px);
  }
}

.star-layer-inner {
  position: absolute;
  inset: 0;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.star-layer-inner.star-layer-drift-0 {
  -webkit-animation: star-layer-drift-0 28s ease-in-out infinite;
  animation: star-layer-drift-0 28s ease-in-out infinite;
}

.star-layer-inner.star-layer-drift-1 {
  -webkit-animation: star-layer-drift-1 22s ease-in-out infinite;
  animation: star-layer-drift-1 22s ease-in-out infinite;
}

.star-layer-inner.star-layer-drift-2 {
  -webkit-animation: star-layer-drift-2 18s ease-in-out infinite;
  animation: star-layer-drift-2 18s ease-in-out infinite;
}

@media (hover: none), (pointer: coarse) {
  .star-layer-inner.star-layer-drift-0 {
    -webkit-animation: star-layer-drift-mobile-0 17s ease-in-out infinite;
    animation: star-layer-drift-mobile-0 17s ease-in-out infinite;
    -webkit-animation-play-state: running !important;
    animation-play-state: running !important;
  }

  .star-layer-inner.star-layer-drift-1 {
    -webkit-animation: star-layer-drift-mobile-1 14s ease-in-out infinite;
    animation: star-layer-drift-mobile-1 14s ease-in-out infinite;
    -webkit-animation-play-state: running !important;
    animation-play-state: running !important;
  }

  .star-layer-inner.star-layer-drift-2 {
    -webkit-animation: star-layer-drift-mobile-2 12s ease-in-out infinite;
    animation: star-layer-drift-mobile-2 12s ease-in-out infinite;
    -webkit-animation-play-state: running !important;
    animation-play-state: running !important;
  }
}

@keyframes shooting-star-streak {
  0% {
    transform: rotate(var(--shoot-angle)) translate3d(0, 0, 0) scaleX(0.15);
    opacity: 0;
  }
  8% {
    opacity: var(--shoot-opacity, 0.55);
  }
  75% {
    opacity: calc(var(--shoot-opacity, 0.55) * 0.35);
  }
  100% {
    transform: rotate(var(--shoot-angle)) translate3d(-115vw, 72vh, 0) scaleX(1);
    opacity: 0;
  }
}

.shooting-star {
  position: absolute;
  width: 72px;
  height: 1px;
  transform-origin: left center;
  pointer-events: none;
  will-change: transform, opacity;
  animation: shooting-star-streak 1.35s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

.star-dot {
  position: absolute;
  border-radius: 9999px;
}

@media (prefers-reduced-motion: reduce) {
  .star-twinkle,
  .shooting-star,
  .star-layer-inner.star-layer-drift-0,
  .star-layer-inner.star-layer-drift-1,
  .star-layer-inner.star-layer-drift-2 {
    animation: none !important;
  }
}

/* —— Hub (quiet density) —— */

.eyebrow {
  margin: 0;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.page-hub {
  color: var(--hub-text);
}

.hub-shell {
  position: relative;
  z-index: 10;
  width: min(56rem, calc(100% - 2.5rem));
  margin: 0 auto;
  padding: 3rem 0 3.5rem;
  animation: atm-enter 0.75s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

.hub-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1rem;
}

@media (min-width: 720px) {
  .hub-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Legacy two-column hub (kept for cached markup) */
.hub-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: start;
  gap: 1rem 1.25rem;
}

.hub-grid--main,
.hub-grid--side {
  min-width: 0;
}

.hub-head {
  margin-bottom: 2rem;
}

.hub-head-brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}

.hub-logout {
  position: fixed;
  top: max(0.85rem, env(safe-area-inset-top, 0px));
  right: max(0.85rem, env(safe-area-inset-right, 0px));
  z-index: 20;
  margin: 0;
}

/* Corner utilities — Trash > Contacts > Passwords; auth-backed, not in the main grid. */
.hub-corner {
  position: fixed;
  left: max(0.85rem, env(safe-area-inset-left, 0px));
  z-index: 20;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  background: var(--surface-panel);
  color: var(--hub-muted);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-decoration: none;
  backdrop-filter: blur(8px);
  transition:
    color 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease;
}

.hub-corner--passwords {
  bottom: max(0.85rem, env(safe-area-inset-bottom, 0px));
}

.hub-corner--contacts {
  /* Stack above Passwords: button height ~2rem + gap */
  bottom: calc(max(0.85rem, env(safe-area-inset-bottom, 0px)) + 2.55rem);
}

.hub-corner--trash {
  /* Stack above Contacts */
  bottom: calc(max(0.85rem, env(safe-area-inset-bottom, 0px)) + 5.1rem);
}

.hub-corner:hover {
  color: var(--accent-soft);
  background: rgba(var(--accent-rgb), 0.08);
  border-color: rgba(var(--accent-rgb), 0.35);
}

.hub-corner:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb), 0.55);
  outline-offset: 2px;
  color: var(--accent-soft);
}

/* Legacy alias (if any cached markup) */
.hub-passwords {
  position: fixed;
  bottom: max(0.85rem, env(safe-area-inset-bottom, 0px));
  left: max(0.85rem, env(safe-area-inset-left, 0px));
  z-index: 20;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  background: var(--surface-panel);
  color: var(--hub-muted);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-decoration: none;
  backdrop-filter: blur(8px);
}

.hub-passwords:hover {
  color: var(--accent-soft);
  background: rgba(var(--accent-rgb), 0.08);
  border-color: rgba(var(--accent-rgb), 0.35);
}

.hub-passwords:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb), 0.55);
  outline-offset: 2px;
  color: var(--accent-soft);
}

.hub-logout-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--hub-muted);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition:
    color 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease;
}

.hub-logout-btn:hover {
  color: var(--hub-text);
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

.hub-logout-btn:active {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
}

.hub-logout-btn:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb), 0.55);
  outline-offset: 2px;
  color: var(--hub-text);
}

.moon-badge {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-line);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 0 18px var(--accent-glow),
    0 8px 22px rgba(0, 0, 0, 0.28);
}

.moon-badge--sm {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  margin: 0;
}

.hub-title {
  margin: 0.15rem 0 0;
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 400;
}

.hub-sub {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: var(--hub-muted);
}

.hub-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr;
}

.hub-grid--side {
  position: relative;
}

.hub-grid--side::before {
  content: "";
  position: absolute;
  left: -0.65rem;
  top: 0.35rem;
  bottom: 0.35rem;
  width: 1px;
  background: linear-gradient(
    180deg,
    transparent,
    rgba(var(--accent-rgb), 0.28),
    transparent
  );
  pointer-events: none;
}

.hub-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1.2rem 1.3rem;
  border-radius: 14px;
  color: inherit;
  text-decoration: none;
  border: 1px solid rgba(var(--accent-rgb), 0.2);
  background:
    linear-gradient(
      165deg,
      rgba(36, 34, 28, 0.55) 0%,
      rgba(16, 18, 24, 0.82) 55%,
      rgba(8, 10, 14, 0.92) 100%
    );
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 -1px 0 rgba(var(--velvet-rgb), 0.24) inset,
    0 14px 32px rgba(0, 0, 0, 0.4),
    0 32px 64px rgba(var(--velvet-deep-rgb), 0.32);
  transition:
    border-color 0.22s ease,
    box-shadow 0.22s ease,
    background 0.22s ease,
    transform 0.22s ease;
}

.hub-card:hover {
  border-color: var(--hub-border-strong);
  transform: translateY(-1px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 -1px 0 rgba(var(--accent-rgb), 0.18) inset,
    0 14px 32px rgba(0, 0, 0, 0.4),
    0 20px 48px rgba(var(--accent-rgb), 0.08);
}

.hub-card:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb), 0.55);
  outline-offset: 3px;
}

.hub-card--soon,
.hub-card--status {
  opacity: 0.5;
  pointer-events: none;
}

.hub-card-name {
  position: relative;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.hub-card-desc {
  position: relative;
  font-size: 0.8rem;
  color: var(--hub-muted);
}

@media (max-width: 700px) {
  .hub-shell {
    width: min(28rem, calc(100% - 2.5rem));
  }

  .hub-nav {
    grid-template-columns: 1fr;
  }

  .hub-layout {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .hub-grid--side::before {
    display: none;
  }

  .hub-grid--side {
    padding-top: 0.35rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
  }
}

/* —— Login (full density) —— */

.page-login {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.login-shell {
  position: relative;
  z-index: 10;
  width: min(21rem, calc(100% - 2rem));
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1.15rem;
  animation: atm-enter 0.85s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

.login-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 2.05rem 1.7rem 1.6rem;
  border-radius: 16px;
  border-color: rgba(var(--accent-rgb), 0.28);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 -1px 0 rgba(var(--velvet-rgb), 0.28) inset,
    0 1px 1px rgba(255, 255, 255, 0.03),
    0 22px 48px rgba(0, 0, 0, 0.52),
    0 56px 100px rgba(0, 0, 0, 0.58),
    0 40px 80px rgba(var(--velvet-rgb), 0.16);
}

.login-brand {
  margin: 0 0 0.15rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--accent-soft);
}

.login-title {
  position: relative;
  margin: 0 0 1.2rem;
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--text);
  text-shadow: 0 1px 18px rgba(0, 0, 0, 0.35);
}

.login-label {
  position: relative;
  margin-top: 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.login-input {
  position: relative;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.74rem 0.92rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(
      180deg,
      rgba(28, 28, 24, 0.55) 0%,
      rgba(0, 0, 0, 0.45) 100%
    );
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 8px 16px rgba(0, 0, 0, 0.22);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.92rem;
  transition:
    border-color 0.22s ease,
    box-shadow 0.22s ease,
    background 0.22s ease,
    transform 0.22s ease;
}

.login-input:hover {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.48);
}

.login-input:focus {
  outline: none;
  border-color: rgba(var(--accent-rgb), 0.45);
  background: rgba(10, 12, 16, 0.68);
  transform: translateY(-1px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.035) inset,
    0 0 0 1px rgba(var(--accent-rgb), 0.2),
    0 10px 26px rgba(0, 0, 0, 0.38),
    0 12px 28px rgba(var(--accent-rgb), 0.08);
}

.login-error {
  position: relative;
  margin: 0.75rem 0 0;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger-text);
  font-size: 0.8rem;
}

.login-submit {
  position: relative;
  margin-top: 1.3rem;
  min-height: 2.75rem;
  border: 1px solid rgba(var(--accent-rgb), 0.42);
  border-radius: 10px;
  background:
    linear-gradient(180deg, var(--accent-btn-top) 0%, var(--accent-btn-bot) 100%);
  color: var(--accent-on);
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.35) inset,
    0 10px 24px rgba(0, 0, 0, 0.28),
    0 8px 20px rgba(var(--accent-rgb), 0.12);
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease,
    opacity 0.15s ease;
}

.login-submit:hover:not(:disabled) {
  background: linear-gradient(180deg, var(--accent-btn-hover-top) 0%, var(--accent-btn-hover-bot) 100%);
  border-color: rgba(var(--accent-rgb), 0.55);
  transform: translateY(-1px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.42) inset,
    0 14px 30px rgba(0, 0, 0, 0.34),
    0 10px 24px rgba(var(--accent-rgb), 0.16);
}

.login-submit:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.28) inset,
    0 4px 12px rgba(0, 0, 0, 0.28);
}

.login-submit:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}

.login-submit:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb), 0.55);
  outline-offset: 3px;
}

.login-back {
  align-self: center;
  color: rgba(235, 232, 226, 0.4);
  font-size: 0.78rem;
  text-decoration: none;
  letter-spacing: 0.02em;
  transition:
    color 0.22s ease,
    opacity 0.22s ease;
}

.login-back:hover {
  color: var(--accent-soft);
}

@media (prefers-reduced-motion: reduce) {
  .login-shell,
  .hub-shell,
  .landing-center {
    animation: none;
  }

  .login-input:focus,
  .login-submit:hover:not(:disabled),
  .login-submit:active:not(:disabled),
  .hub-card:hover {
    transform: none;
  }
}
