:root {
  --bg: #000106;
  --panel: rgba(7, 12, 24, .78);
  --ink: #edf5ff;
  --muted: #9aaac2;
  --line: rgba(145, 190, 235, .2);
  --accent: #267fc7;
  --accent-dark: #1f659f;
  --good: #62d6ad;
  --warn: #f2b86b;
  --iti-path-flags-1x: url('/assets/intl-tel-input/flags.webp');
  --iti-path-flags-2x: url('/assets/intl-tel-input/flags@2x.webp');
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  position: relative;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: #000106;
  font: 16px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.site-stars { position: fixed; z-index: 0; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.topbar, .page { position: relative; z-index: 1; }
body:not(.cosmic-home) .hero { color: #eef6ff; text-shadow: 0 2px 18px rgba(0,0,0,.9); }
body:not(.cosmic-home) .hero .muted { color: rgba(218,229,246,.78); }
a { color: #7edcff; text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px clamp(16px, 4vw, 48px);
  background: rgba(3, 6, 14, .78);
  border-bottom: 1px solid rgba(145, 190, 235, .18);
  box-shadow: 0 10px 36px rgba(0,0,0,.34), inset 0 -1px rgba(255,255,255,.015);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.brand { color: #f2f8ff; font-weight: 800; text-shadow: 0 0 18px rgba(105,215,255,.28); }
.topbar nav { display: flex; gap: 16px; flex-wrap: wrap; }
.topbar nav a { color: rgba(219,235,252,.82); }
.page { width: min(1100px, calc(100% - 32px)); margin: 28px auto 56px; }
.stack { display: grid; gap: 18px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.panel, .card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 22px 70px rgba(0,0,0,.42), inset 0 1px rgba(255,255,255,.025);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.hero {
  display: grid;
  gap: 12px;
  padding: clamp(24px, 6vw, 52px) 0 20px;
}
h1, h2, h3 { line-height: 1.15; margin: 0 0 10px; }
h1 { font-size: clamp(2rem, 5vw, 3.4rem); }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
form { display: grid; gap: 12px; }
label { display: grid; gap: 6px; font-weight: 700; }
input, select, textarea {
  width: 100%;
  border: 1px solid rgba(145,190,235,.3);
  border-radius: 10px;
  padding: 12px;
  font: inherit;
  background: rgba(1,5,14,.76);
  color: var(--ink);
  box-shadow: inset 0 1px 12px rgba(0,0,0,.3);
}
input::placeholder, textarea::placeholder { color: rgba(174,191,215,.58); }
select option { background: #07101f; color: #edf5ff; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(91,215,255,.32); outline-offset: 1px; border-color: rgba(112,225,255,.58); }
.iti { width: 100%; }
textarea { min-height: 96px; resize: vertical; }
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 8px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #267fc7, #185789);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  border: 1px solid rgba(130,220,255,.2);
  box-shadow: 0 8px 24px rgba(22,102,166,.24);
}
button:hover, .button:hover { background: var(--accent-dark); text-decoration: none; }
.button.secondary { background: rgba(143,177,215,.13); color: var(--ink); border-color: rgba(160,200,240,.18); box-shadow: none; }
.notice {
  border-left: 4px solid var(--accent);
  background: rgba(25,92,150,.18);
  padding: 12px 14px;
  border-radius: 8px;
}
.error {
  border-left: 4px solid #c32929;
  background: rgba(146,28,42,.2);
  padding: 12px 14px;
  border-radius: 8px;
}
.ok {
  border-left: 4px solid var(--good);
  background: rgba(25,119,89,.18);
  padding: 12px 14px;
  border-radius: 8px;
}
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { color: #dcecff; }
.table tbody tr:hover { background: rgba(83,147,255,.055); }
.relation-list { display: grid; gap: 8px; padding: 0; list-style: none; }
.relation-list li { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(7,16,32,.68); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
@media (max-width: 640px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .table { display: block; overflow-x: auto; }
}

.cosmic-family {
  position: relative;
  width: min(1500px, calc(100vw - 24px));
  height: clamp(560px, 76vh, 840px);
  margin: -12px 50% 0;
  transform: translateX(-50%);
  overflow: hidden;
  border: 1px solid rgba(122, 169, 255, .18);
  border-radius: 22px;
  background: #000106;
  box-shadow: 0 28px 90px rgba(0, 0, 0, .58), inset 0 0 70px rgba(70, 80, 105, .05);
  color: #eef6ff;
}
#familyCosmos { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
#familyCosmos:active { cursor: grabbing; }
.cosmic-vignette { position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 130px 40px rgba(0, 0, 0, .68); }
.cosmic-heading { position: absolute; left: clamp(18px, 4vw, 54px); top: clamp(18px, 5vw, 58px); max-width: min(420px, 70%); pointer-events: none; text-shadow: 0 3px 20px #000; }
.cosmic-heading h1 { margin: 3px 0 4px; font-size: clamp(1.8rem, 4vw, 3.6rem); letter-spacing: -.04em; }
.cosmic-heading p { color: rgba(202, 218, 255, .72); }
.cosmic-heading .cosmic-path { max-width: 34rem; color: rgba(151, 174, 225, .72); font-size: .82rem; line-height: 1.35; }
.cosmic-heading a { color: #8eeeff; pointer-events: auto; }
.cosmic-heading h1,.cosmic-heading p,.cosmic-heading a { transition: opacity .12s ease, transform .12s ease; }
.cosmic-heading.is-receiving h1,.cosmic-heading.is-receiving p,.cosmic-heading.is-receiving a { opacity: 0; transform: translateY(5px); }
.cosmic-name-flight { position: fixed; z-index: 1002; margin: 0; transform: translate(-50%,-50%); color: #eef8ff; font: 600 13px/1.1 system-ui,sans-serif; text-shadow: 0 0 12px rgba(116,220,255,.9),0 2px 10px #000; white-space: nowrap; pointer-events: none; }
.cosmic-kicker { color: rgba(137, 217, 255, .78); font-size: .72rem; letter-spacing: .24em; }
.return-to-me { position: absolute; z-index: 3; top: 28px; left: 50%; transform: translateX(-50%); border: 1px solid rgba(138, 230, 255, .5); border-radius: 999px; padding: 11px 19px; background: rgba(5, 14, 38, .72); color: #dffcff; box-shadow: 0 0 28px rgba(91, 215, 255, .18); backdrop-filter: blur(14px); animation: cosmic-float 4.8s ease-in-out infinite; }
.return-to-me span { width: 7px; height: 7px; border-radius: 50%; background: #78edff; box-shadow: 0 0 12px #78edff; }
.return-to-me:hover { background: rgba(16, 42, 83, .9); }
.view-mode-toggle { position: absolute; z-index: 4; top: 84px; left: 50%; transform: translateX(-50%); border: 1px solid rgba(150,180,255,.36); border-radius: 999px; padding: 8px 13px; background: rgba(5,14,38,.68); color: rgba(225,238,255,.9); box-shadow: 0 0 24px rgba(91,150,255,.12); backdrop-filter: blur(14px); font-size: .78rem; }
.view-mode-toggle span { width: 7px; height: 7px; border-radius: 50%; background: #88aaff; box-shadow: 0 0 10px #88aaff; }
.view-mode-toggle.is-free { border-color: rgba(122,238,255,.62); color: #e6fcff; }
.view-mode-toggle.is-free span { background: #70f0ff; box-shadow: 0 0 13px #70f0ff; }
.view-mode-toggle:hover { background: rgba(16,42,83,.9); }
.cosmic-hint { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); white-space: nowrap; color: rgba(196, 211, 246, .58); font-size: .78rem; pointer-events: none; }
@keyframes cosmic-float { 0%,100% { transform: translate(-50%,0); } 50% { transform: translate(-50%,9px); } }
@media (max-width: 640px) { .cosmic-family { height: 72vh; min-height: 520px; border-radius: 14px; } .return-to-me { top: auto; bottom: 48px; } .cosmic-hint { bottom: 16px; } }
@media (prefers-reduced-motion: reduce) { .return-to-me { animation: none; } }

/* Authenticated constellation landing */
.cosmic-home { background: transparent; }
.cosmic-home .topbar {
  position: fixed;
  z-index: 20;
  inset: 12px 14px auto;
  padding: 0;
  border: 0;
  background: transparent;
  pointer-events: none;
}
.cosmic-home .brand,
.cosmic-home .topbar nav {
  border: 1px solid rgba(138, 196, 255, .23);
  background: rgba(3, 5, 12, .76);
  box-shadow: 0 12px 42px rgba(0, 0, 0, .46), inset 0 0 20px rgba(180, 200, 230, .025);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  pointer-events: auto;
}
.cosmic-home .brand {
  padding: 10px 15px;
  border-radius: 999px;
  color: #eaf7ff;
  text-shadow: 0 0 16px rgba(113, 224, 255, .5);
}
.cosmic-home .topbar nav {
  max-width: min(78vw, 1080px);
  padding: 6px;
  border-radius: 999px;
  gap: 3px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.cosmic-home .topbar nav::-webkit-scrollbar { display: none; }
.cosmic-home .topbar nav a {
  flex: 0 0 auto;
  padding: 7px 11px;
  border-radius: 999px;
  color: rgba(224, 239, 255, .82);
  font-size: .82rem;
  transition: color .2s ease, background .2s ease, box-shadow .2s ease;
}
.cosmic-home .topbar nav a:hover {
  color: #fff;
  text-decoration: none;
  background: rgba(83, 147, 255, .2);
  box-shadow: 0 0 18px rgba(73, 205, 255, .12);
}
.cosmic-home .return-to-me { top: 76px; }
.cosmic-home .view-mode-toggle { top: 132px; }
.cosmic-home .page { width: 100%; margin: 0; }
.cosmic-home .cosmic-family {
  width: 100%;
  height: 100svh;
  min-height: 620px;
  margin: 0;
  transform: none;
  border: 0;
  border-radius: 0;
  box-shadow: inset 0 0 100px rgba(65, 75, 100, .045);
}
.cosmic-home .cosmic-heading { top: clamp(86px, 13vh, 132px); }
.cosmic-more {
  position: absolute;
  z-index: 5;
  right: clamp(16px, 3vw, 42px);
  bottom: clamp(18px, 3vw, 34px);
  display: grid;
  gap: 1px;
  min-width: 82px;
  padding: 10px 15px;
  border: 1px solid rgba(138, 230, 255, .42);
  border-radius: 999px;
  background: rgba(5, 14, 38, .68);
  color: #dffcff;
  box-shadow: 0 0 30px rgba(91, 215, 255, .16);
  backdrop-filter: blur(14px);
  animation: cosmic-more-float 3.8s ease-in-out infinite;
}
.cosmic-more span { font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; }
.cosmic-more b { font-size: 1rem; line-height: 1; }
.cosmic-more:hover { background: rgba(16, 42, 83, .9); }
.home-below {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 72px;
  scroll-margin-top: 24px;
}
.cosmic-home:has(.home-below) { background: transparent; }
@keyframes cosmic-more-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(7px); } }
@media (max-width: 760px) {
  .cosmic-home .topbar { align-items: stretch; inset: 8px 8px auto; gap: 6px; }
  .cosmic-home .brand { align-self: flex-start; padding: 7px 11px; font-size: .82rem; }
  .cosmic-home .topbar nav { width: 100%; max-width: none; }
  .cosmic-home .cosmic-family { height: 100svh; min-height: 560px; border-radius: 0; }
  .cosmic-home .cosmic-heading { top: 116px; max-width: 76%; }
  .cosmic-home .return-to-me { top: auto; bottom: 58px; }
  .cosmic-home .view-mode-toggle { top: 106px; left: auto; right: 10px; transform: none; }
  .cosmic-home .cosmic-hint { bottom: 24px; }
  .cosmic-more { right: 12px; bottom: 18px; min-width: 64px; padding: 9px 11px; }
  .cosmic-more span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .cosmic-more { animation: none; }
}
.relative-modal[hidden] { display: none; }
.relative-modal { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: clamp(10px,3vw,32px); }
.relative-modal-backdrop { position: absolute; inset: 0; background: rgba(0,1,8,.78); backdrop-filter: blur(9px); }
.relative-modal-card { position: relative; width: min(760px,96vw); height: min(820px,92vh); overflow: hidden; border: 1px solid rgba(117,215,255,.36); border-radius: 22px; background: #030711; box-shadow: 0 28px 90px rgba(0,0,0,.72),0 0 42px rgba(81,194,255,.13); }
.relative-modal-bar { height: 54px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px 0 20px; color: #eaf8ff; background: linear-gradient(110deg,#071021,#0c1e35); }
.relative-modal-bar button { width: 36px; height: 36px; padding: 0; border: 1px solid rgba(173,228,255,.28); border-radius: 50%; background: rgba(255,255,255,.06); color: #fff; font-size: 1.5rem; line-height: 1; }
.relative-modal iframe { display: block; width: 100%; height: calc(100% - 54px); border: 0; background: #030711; }
.relative-modal-open { overflow: hidden; }
.relative-embed .topbar { display: none; }
.relative-embed .page { width: min(680px,calc(100% - 24px)); margin: 12px auto 28px; }
.relative-embed .panel { padding: clamp(14px,3vw,24px); border: 0; box-shadow: none; }
.relative-embed h1 { margin: 0; font-size: clamp(1.7rem,6vw,2.5rem); }
.relative-embed .panel > p:nth-of-type(2),.relative-embed .panel > p:nth-of-type(3),.relative-embed .panel > p:nth-of-type(4) { display: none; }
.relative-embed textarea { min-height: 70px; }
@media (max-width: 640px) {
  .relative-modal { padding: 0; }
  .relative-modal-card { width: 100%; height: 100%; max-height: none; border: 0; border-radius: 0; }
}
code{overflow-wrap:anywhere;word-break:break-word}

/* Android identity pages require the installed PWA. */
.pwa-gate[hidden] { display: none; }
.pwa-gate {
  position: fixed;
  z-index: 2000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 1, 7, .9);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.pwa-gate-card {
  width: min(520px, 100%);
  padding: clamp(24px, 6vw, 42px);
  border: 1px solid rgba(116, 218, 255, .3);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(7, 15, 31, .96), rgba(2, 4, 12, .96));
  box-shadow: 0 30px 100px rgba(0, 0, 0, .72), 0 0 40px rgba(68, 196, 255, .1);
  text-align: center;
}
.pwa-gate-mark {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin: 0 auto 20px;
  border: 1px solid rgba(114, 233, 255, .52);
  border-radius: 22px;
  background: rgba(47, 137, 255, .13);
  color: #8af2ff;
  box-shadow: 0 0 32px rgba(83, 220, 255, .2);
  font-size: 2rem;
  font-weight: 800;
}
.pwa-gate-card h1 { margin: 0 0 12px; font-size: clamp(1.8rem, 7vw, 2.7rem); }
.pwa-gate-card p { color: rgba(218, 232, 255, .76); }
.pwa-gate-card .button { width: 100%; margin-top: 12px; }
.pwa-gate-help { font-size: .86rem; }
.pwa-gate-status { min-height: 1.4em; color: #9eeeff !important; }
body.pwa-gated > :not(.pwa-gate):not(.site-stars) { pointer-events: none; user-select: none; }
