  :root {
    --bg: #05060f;
    --bg-2: #0f0a26;
    --ink: #f7ecec;
    --dim: #c79ab4;
    --accent: #ffd6e0;
    --card: rgba(255,255,255,0.05);
    --line: rgba(255,200,220,0.12);
  }
  * { box-sizing: border-box; }
  html, body { margin: 0; padding: 0; }
  body {
    font: 16px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
    color: var(--ink);
    background:
      radial-gradient(ellipse 90% 70%  at 30% 25%, rgba(255,110,180,0.28) 0%, rgba(255,110,180,0.10) 40%, transparent 85%),
      radial-gradient(ellipse 95% 75%  at 75% 40%, rgba(140,95,255,0.30)  0%, rgba(140,95,255,0.10)  45%, transparent 85%),
      radial-gradient(ellipse 100% 80% at 55% 75%, rgba(70,130,255,0.30)  0%, rgba(70,130,255,0.10)  45%, transparent 90%),
      radial-gradient(ellipse 85% 65%  at 15% 70%, rgba(190,90,230,0.26)  0%, rgba(190,90,230,0.08)  45%, transparent 85%),
      radial-gradient(ellipse 110% 85% at 85% 90%, rgba(80,160,255,0.22)  0%, rgba(80,160,255,0.08)  45%, transparent 90%),
      radial-gradient(ellipse 120% 95% at 50% 50%, rgba(28,16,60,0.55)    0%, transparent 80%),
      var(--bg);
    background-attachment: fixed;
    min-height: 100vh;
    min-height: 100dvh;
    padding: max(env(safe-area-inset-top), 20px) 20px max(env(safe-area-inset-bottom), 24px);
    display: flex;
    justify-content: center;
    position: relative;
    overflow-x: hidden;
  }
  /* twinkling stars */
  body::before, body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-repeat: repeat;
  }
  body::before {
    background-size: 280px 280px;
    background-image:
      radial-gradient(2.4px 2.4px at 17% 14%, #fff 30%, rgba(255,255,255,0.4) 60%, transparent 75%),
      radial-gradient(1.6px 1.6px at 42% 8%, #ffe9a8, transparent 60%),
      radial-gradient(2.8px 2.8px at 73% 23%, #fff 30%, rgba(255,255,255,0.4) 60%, transparent 75%),
      radial-gradient(1.6px 1.6px at 88% 56%, #c8d4ff, transparent 60%),
      radial-gradient(2.2px 2.2px at 5% 71%, #fff 30%, rgba(255,255,255,0.5) 60%, transparent 75%),
      radial-gradient(1.6px 1.6px at 31% 82%, #ffe9a8, transparent 60%),
      radial-gradient(2.4px 2.4px at 58% 91%, #fff 30%, rgba(255,255,255,0.4) 60%, transparent 75%),
      radial-gradient(1.4px 1.4px at 92% 38%, #fff, transparent 60%);
    opacity: 0.4;
    animation: twinkle 5s ease-in-out infinite alternate;
  }
  body::after {
    background-size: 200px 200px;
    background-image:
      radial-gradient(1.4px 1.4px at 12% 47%, #fff, transparent 60%),
      radial-gradient(1.4px 1.4px at 64% 12%, #c8d4ff, transparent 60%),
      radial-gradient(1.4px 1.4px at 81% 78%, #fff, transparent 60%),
      radial-gradient(1.2px 1.2px at 27% 33%, #ffe9a8, transparent 60%),
      radial-gradient(1.4px 1.4px at 49% 64%, #fff, transparent 60%),
      radial-gradient(1.2px 1.2px at 7% 22%, #fff, transparent 60%),
      radial-gradient(1.2px 1.2px at 37% 56%, #c8d4ff, transparent 60%),
      radial-gradient(1.2px 1.2px at 71% 41%, #fff, transparent 60%),
      radial-gradient(1.2px 1.2px at 93% 18%, #ffe9a8, transparent 60%),
      radial-gradient(1.2px 1.2px at 22% 92%, #fff, transparent 60%);
    background-position: 100px 100px;
    opacity: 0.3;
    animation: twinkle 8s ease-in-out infinite alternate-reverse;
  }
  /* hyperspace starfield canvas */
  .starfield {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
  }
  @keyframes twinkle {
    from { opacity: 0.18; }
    to   { opacity: 0.45; }
  }
  @media (prefers-reduced-motion: reduce) {
    .starfield { display: none; }
  }
  main { position: relative; z-index: 1; }
  main { width: 100%; max-width: 440px; }
  header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
  }
  h1 {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--dim);
    margin: 0;
  }
  .lang {
    display: inline-flex;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 2px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
  }
  .lang button {
    background: transparent;
    border: 0;
    color: var(--dim);
    padding: 4px 10px;
    border-radius: 999px;
    cursor: pointer;
    font: inherit;
    text-transform: uppercase;
  }
  .lang button.on { background: rgba(255,182,210,0.16); color: var(--accent); }
  .header-controls { display: inline-flex; align-items: center; gap: 8px; }
  .toggle-all {
    background: var(--card);
    border: 1px solid var(--line);
    color: var(--dim);
    width: 28px; height: 28px;
    border-radius: 999px;
    cursor: pointer;
    font: inherit;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    transition: color 0.15s, border-color 0.15s;
  }
  .toggle-all:hover { color: var(--ink); border-color: rgba(255,200,220,0.25); }
  .moon-wrap { display: flex; justify-content: center; margin: 8px 0 14px; position: relative; }
  .moon-wrap::before {
    content: "";
    position: absolute;
    width: 240px;
    height: 240px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(255,182,210,0.20), transparent 65%);
    animation: glow 4s ease-in-out infinite alternate;
    pointer-events: none;
  }
  @keyframes glow {
    from { opacity: 0.6; transform: translate(-50%,-50%) scale(0.95); }
    to   { opacity: 1;   transform: translate(-50%,-50%) scale(1.05); }
  }
  .moon { width: 180px; height: 180px; position: relative; z-index: 1; }
  .moon-real {
    position: absolute;
    top: 50%; left: 50%;
    width: 180px; height: 180px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.45s ease;
    pointer-events: none;
    z-index: 2;
    filter: drop-shadow(0 0 40px rgba(255,182,210,0.25));
  }
  .moon-real[hidden] { display: none; }
  .moon-wrap.show-real .moon-real { opacity: 1; }
  @media (hover: hover) {
    .moon-wrap:hover .moon-real { opacity: 1; }
  }
  .moon-wrap { cursor: help; }
  .moon-credit {
    text-align: center;
    color: var(--dim);
    font-size: 11px;
    letter-spacing: 0.04em;
    margin: -8px 0 10px;
    opacity: 0;
    transition: opacity 0.45s ease;
    pointer-events: none;
  }
  .moon-credit[hidden] { display: none; }
  .moon-wrap.show-real + .moon-credit { opacity: 0.7; }
  @media (hover: hover) {
    .moon-wrap:hover + .moon-credit { opacity: 0.7; }
  }
  .phase-name {
    text-align: center;
    font-size: 28px;
    font-weight: 600;
    margin: 6px 0 4px;
    letter-spacing: -0.01em;
  }
  .sub { text-align: center; color: var(--dim); font-size: 14px; margin-bottom: 6px; }
  .sub b { color: var(--ink); font-weight: 500; }
  .moon-extra { text-align: center; color: var(--dim); font-size: 12px; margin-bottom: 24px; }
  .moon-extra b { color: var(--ink); font-weight: 500; }
  .moon-extra:empty { margin-bottom: 0; }
  .next-full {
    background: linear-gradient(135deg, rgba(255,182,210,0.16), rgba(255,182,210,0.04));
    border: 1px solid rgba(255,182,210,0.28);
    border-radius: 16px;
    padding: 14px 16px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
  }
  .next-full .ico { font-size: 30px; line-height: 1; }
  .next-full .label {
    color: var(--accent);
    font-size: 11px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 2px;
  }
  .next-full .when { font-size: 16px; font-weight: 600; }
  .next-full .away { color: var(--dim); font-size: 13px; margin-top: 2px; }
  .facts { list-style: none; margin: 0; padding: 6px 2px; display: flex; flex-direction: column; gap: 14px; }
  .facts li { font-size: 13px; line-height: 1.6; color: var(--dim); }
  .facts li b { color: var(--ink); font-weight: 600; }
  h2 {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--dim);
    margin: 0 0 10px 4px;
  }
  section { margin-bottom: 22px; }
  section:last-of-type { margin-bottom: 16px; }
  ul.list {
    list-style: none;
    margin: 0;
    padding: 0;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
  }
  ul.list li {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--line);
  }
  ul.list li:last-child { border-bottom: none; }
  ul.list .ico { font-size: 22px; line-height: 1; width: 28px; text-align: center; }
  ul.list .name { flex: 1; font-weight: 500; }
  ul.list .date { color: var(--dim); font-size: 14px; text-align: right; }
  ul.list .date small { display: block; font-size: 11px; opacity: 0.75; }
  .sky li .name { font-weight: 500; }
  .sky li .date { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 500; }
  .sky li .date small { font-weight: 400; color: var(--dim); }
  footer {
    text-align: center;
    color: var(--dim);
    font-size: 11px;
    margin-top: 24px;
    opacity: 0.7;
  }
  .loc-note { text-align: center; color: var(--dim); font-size: 12px; margin: 0 0 12px; }
  .loc-note button {
    background: transparent; border: 1px solid var(--line); color: var(--dim);
    border-radius: 999px; padding: 3px 10px; font: inherit; font-size: 11px;
    cursor: pointer; margin-left: 6px;
  }
  .loc-note button:hover { color: var(--ink); border-color: var(--ink); }
  .loc-pick {
    margin: 4px 0 14px;
    position: relative;
  }
  .loc-pick-row {
    display: flex;
    gap: 6px;
    align-items: center;
  }
  .loc-pick input {
    flex: 1;
    background: var(--card);
    border: 1px solid var(--line);
    color: var(--ink);
    border-radius: 999px;
    padding: 7px 14px;
    font: inherit;
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s;
  }
  .loc-pick input:focus { border-color: rgba(255,200,220,0.35); }
  .loc-pick input::placeholder { color: var(--dim); }
  .loc-pick .loc-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: #110a2a;
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    z-index: 5;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    max-height: 260px;
    overflow-y: auto;
  }
  .loc-pick .loc-results button {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: 0;
    color: var(--ink);
    padding: 9px 14px;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 1px solid var(--line);
  }
  .loc-pick .loc-results button:last-child { border-bottom: none; }
  .loc-pick .loc-results button:hover { background: rgba(255,200,220,0.08); }
  .loc-pick .loc-results button small { display: block; color: var(--dim); font-size: 11px; margin-top: 2px; }
  .loc-pick .loc-results .empty { padding: 9px 14px; color: var(--dim); font-size: 12px; }
  .made-by {
    text-align: center;
    margin-top: 10px;
    font-size: 11px;
    color: var(--dim);
    opacity: 0.75;
  }
  .made-by a { color: var(--accent); text-decoration: none; }
  .made-by a:hover { text-decoration: underline; }
  .deploy-badge { text-align: center; margin-top: 8px; opacity: 0.6; }
  .deploy-badge img { height: 14px; vertical-align: middle; }
  .weather {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px 16px;
    margin-bottom: 8px;
  }
  .weather .ico { font-size: 30px; line-height: 1; }
  .weather .temp { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
  .weather .cond { color: var(--dim); font-size: 13px; margin-top: 2px; }
  .weather .hi-lo { color: var(--dim); font-size: 12px; font-variant-numeric: tabular-nums; margin-left: auto; text-align: right; }
  .weather .hi-lo b { color: var(--ink); font-weight: 500; }
  .weather.loading { opacity: 0.55; }
  .tonight-strip {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
  }
  .tonight-strip[hidden] { display: none; }
  .tonight-strip .chip {
    flex: 1 1 0;
    text-align: center;
  }
  .chip {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 7px 12px;
    font-size: 12px;
    color: var(--ink);
    line-height: 1.3;
  }
  .chip b { font-weight: 600; }
  details.twilight { margin-top: 10px; }
  details.twilight summary {
    list-style: none;
    cursor: pointer;
    color: var(--dim);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    padding: 8px 4px;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  details.twilight summary::-webkit-details-marker { display: none; }
  details.twilight summary::before {
    content: "›";
    display: inline-block;
    transition: transform 0.15s;
    font-size: 14px;
    line-height: 1;
  }
  details.twilight[open] summary::before { transform: rotate(90deg); }
  details.twilight summary:hover { color: var(--ink); }
  details.twilight ul.list { margin-top: 6px; }
  section.upcoming > details.twilight { margin-top: 0; }
  section.upcoming > details.twilight > summary { padding: 0 4px 10px; }
  section.upcoming > details.twilight > ul.list { margin-top: 0; }
  .apod {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
    color: inherit;
  }
  .apod > a { display: block; text-decoration: none; color: inherit; }
  .apod img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    background: rgba(255,255,255,0.03);
  }
  .apod-body { padding: 12px 16px 14px; }
  .apod-title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
  .apod-meta { color: var(--dim); font-size: 12px; margin-top: 2px; }
  .apod-explain { margin-top: 8px; }
  .apod-explain summary {
    list-style: none;
    cursor: pointer;
    color: var(--dim);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    padding: 6px 0;
    user-select: none;
    display: flex; align-items: center; gap: 6px;
  }
  .apod-explain summary::-webkit-details-marker { display: none; }
  .apod-explain summary::before {
    content: "›";
    display: inline-block;
    transition: transform 0.15s;
    font-size: 14px;
    line-height: 1;
  }
  .apod-explain[open] summary::before { transform: rotate(90deg); }
  .apod-explain summary:hover { color: var(--ink); }
  .apod-explain p { margin: 4px 0 0; font-size: 13px; line-height: 1.55; color: var(--dim); }
  .zodiac {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px 18px;
  }
  .z-symbol {
    font-size: 44px;
    line-height: 1;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(255,182,210,0.20), rgba(255,182,210,0.04));
    color: var(--accent);
  }
  .z-info { flex: 1; }
  .z-name { font-size: 18px; font-weight: 600; }
  .z-meta { font-size: 13px; color: var(--dim); margin-top: 2px; }
  .z-dates { font-size: 12px; color: var(--dim); margin-top: 4px; font-variant-numeric: tabular-nums; }
  .cal-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 12px;
  }
  .btn {
    text-decoration: none;
    color: var(--dim);
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    transition: color 0.15s, border-color 0.15s;
  }
  .btn:hover { color: var(--ink); border-color: rgba(255,200,220,0.25); }
  .btn.primary { color: var(--dim); }
  .notifs-body { padding: 4px 0 8px; }
  .notifs-status { font-size: 12px; color: var(--dim); margin: 0 4px 10px; }
  .notifs-status.err { color: #ffb4c4; }
  .notifs-prefs {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
  }
  .notifs-prefs label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-direction: row-reverse;
    gap: 12px;
    min-height: 48px;
    padding: 10px 14px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    font-size: 14px;
    color: var(--ink);
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: border-color 0.15s, background 0.15s;
  }
  .notifs-prefs label:hover { border-color: rgba(255,200,220,0.25); }
  .notifs-prefs label:has(input:checked) {
    background: rgba(255,182,210,0.08);
    border-color: rgba(255,200,220,0.3);
  }
  .notifs-prefs input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    flex-shrink: 0;
    width: 40px; height: 24px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    border: 1px solid var(--line);
    cursor: pointer;
    position: relative;
    transition: background 0.15s, border-color 0.15s;
  }
  .notifs-prefs input[type="checkbox"]::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 2px;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--dim);
    transform: translateY(-50%);
    transition: transform 0.18s ease, background 0.15s;
  }
  .notifs-prefs input[type="checkbox"]:checked {
    background: rgba(255,182,210,0.35);
    border-color: rgba(255,200,220,0.5);
  }
  .notifs-prefs input[type="checkbox"]:checked::after {
    transform: translate(16px, -50%);
    background: var(--accent);
  }
  .notifs-prefs input[type="checkbox"]:focus-visible {
    outline: 2px solid rgba(255,200,220,0.5);
    outline-offset: 2px;
  }
  .notifs-actions { display: flex; gap: 8px; padding: 0 4px; justify-content: center; }
  .notifs-actions .btn {
    cursor: pointer;
    min-height: 40px;
    padding: 8px 18px;
    font-size: 13px;
  }
