/* Star Viewer — full-screen sky with frosted, see-through panels. */
:root {
  --bg: #050816;
  --text: #eef2ff;
  --muted: #a6b2d8;
  --line: rgba(255, 255, 255, 0.13);
  --glass: rgba(16, 24, 52, 0.26);
  --glass-strong: rgba(14, 20, 44, 0.58);
  --accent: #8fb8ff;
  --accent2: #c9a2ff;
  --gold: #ffd98a;
  --ok: #7ee0b0;
  --err: #ff9a9a;
  --r: 18px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); overflow: hidden; -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
html.night { filter: grayscale(1) sepia(1) saturate(6) hue-rotate(-40deg) brightness(0.62) contrast(1.2); }
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); }
kbd { font: 600 11px var(--font); padding: 1px 6px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted); }
[hidden] { display: none !important; }

#sky { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; touch-action: none; cursor: grab; }
#sky:active { cursor: grabbing; }

/* ---------- glass ---------- */
.glass {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02)), var(--glass);
  border: 1px solid var(--line);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .glass { background: rgba(12, 18, 40, 0.86); } }

/* ---------- top bar ---------- */
.top { position: fixed; top: calc(10px + var(--safe-t)); left: 12px; right: 12px; display: flex; gap: 10px; align-items: center; z-index: 5; pointer-events: none; }
.top > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px 0 9px; border-radius: 999px; font-weight: 750; letter-spacing: 0.2px; cursor: pointer; }
.brand img { filter: drop-shadow(0 0 6px rgba(160, 190, 255, 0.6)); }
.search { position: relative; flex: 1 1 0; min-width: 0; max-width: 520px; display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px; border-radius: 999px; margin: 0 auto; }
.search svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; flex: none; }
.search input, .search input[type="search"] { flex: 1; min-width: 0; width: auto; border: 0; outline: 0; background: transparent; font-size: 15px; padding: 0; border-radius: 0; }
.search input::placeholder { color: rgba(200, 210, 240, 0.6); }
.search input::-webkit-search-cancel-button { filter: invert(1); opacity: 0.5; }
.results { position: absolute; top: 52px; left: 0; right: 0; list-style: none; margin: 0; padding: 6px; border-radius: 16px; max-height: min(60vh, 420px); overflow: auto; background: var(--glass-strong); }
.results li { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 11px; cursor: pointer; }
.results li[aria-selected="true"], .results li:hover { background: rgba(143, 184, 255, 0.16); }
.results .ic { width: 26px; height: 26px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 13px; background: rgba(255, 255, 255, 0.08); }
.results .t { flex: 1; min-width: 0; }
.results .t b { display: block; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.results .t small { color: var(--muted); }
.results .tag { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; white-space: nowrap; }
.results .tag.up { color: var(--ok); border-color: rgba(126, 224, 176, 0.4); }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 44px; padding: 0 14px; border-radius: 999px; cursor: pointer; font-weight: 600; white-space: nowrap; font-size: 14px; }
.chip:hover, .brand:hover { border-color: rgba(255, 255, 255, 0.24); }
.chip svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.dot.live { background: var(--ok); box-shadow: 0 0 8px var(--ok); animation: pulse 2.4s infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }
.acct.in { color: var(--text); }
.acct.pro { background: linear-gradient(135deg, rgba(143, 184, 255, 0.28), rgba(201, 162, 255, 0.28)); border-color: rgba(201, 162, 255, 0.45); }

.motd { position: fixed; top: calc(64px + var(--safe-t)); left: 50%; transform: translateX(-50%); padding: 8px 16px; border-radius: 999px; font-size: 13px; z-index: 4; max-width: calc(100vw - 24px); text-align: center; }
.locchip { position: fixed; left: 12px; bottom: calc(94px + var(--safe-b)); z-index: 4; height: 36px; font-size: 13px; padding: 0 12px; }
.hud { position: fixed; right: 16px; bottom: calc(100px + var(--safe-b)); z-index: 4; font: 600 12px var(--font); color: rgba(200, 212, 245, 0.7); letter-spacing: 0.4px; text-shadow: 0 1px 2px #000; pointer-events: none; }

/* ---------- dock ---------- */
.dock { position: fixed; left: 50%; bottom: calc(14px + var(--safe-b)); transform: translateX(-50%); display: flex; gap: 2px; padding: 6px; border-radius: 22px; z-index: 5; max-width: calc(100vw - 16px); }
.dock button { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 62px; padding: 7px 8px 6px; border: 0; background: none; border-radius: 15px; cursor: pointer; color: var(--muted); font-size: 11.5px; font-weight: 600; }
.dock button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.dock button:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.dock button.on { color: var(--text); background: rgba(143, 184, 255, 0.18); }
.dock button.pro { color: var(--gold); }
.dock button.pro svg { fill: rgba(255, 217, 138, 0.25); }
.dock button .lk { font-size: 9px; margin-left: 2px; }

/* ---------- info card ---------- */
.info { position: fixed; right: 16px; top: calc(70px + var(--safe-t)); width: 360px; max-height: calc(100vh - 190px); overflow: auto; border-radius: 22px; padding: 18px 18px 14px; z-index: 6; animation: rise 0.28s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(0.98); } }
.x { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06); cursor: pointer; font-size: 20px; line-height: 1; color: var(--muted); }
.x:hover { color: var(--text); }
.info-head { display: flex; gap: 14px; align-items: center; padding-right: 30px; }
.swatch { width: 46px; height: 46px; border-radius: 50%; flex: none; box-shadow: 0 0 22px currentColor, 0 0 4px #fff inset; }
.info h2 { margin: 0; font-size: 22px; line-height: 1.15; letter-spacing: 0.2px; }
.info .sub { margin: 3px 0 0; color: var(--muted); font-size: 13.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 6px; }
.chips span { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); border: 1px solid var(--line); }
.chips span.up { color: var(--ok); border-color: rgba(126, 224, 176, 0.35); }
.chips span.down { color: #ffb9a0; border-color: rgba(255, 185, 160, 0.3); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin: 12px 0 4px; }
.grid div { min-width: 0; }
.grid dt { font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--muted); }
.grid dd { margin: 1px 0 0; font-weight: 600; font-size: 14px; }
.grid .wide { grid-column: 1 / -1; }
.note { color: #d6defa; margin: 12px 0 4px; font-size: 14px; }
.info-actions { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }

/* ---------- panels ---------- */
.panel { position: fixed; left: 16px; top: calc(70px + var(--safe-t)); width: 340px; max-height: calc(100vh - 190px); overflow: auto; border-radius: 22px; padding: 14px 16px 16px; z-index: 6; animation: rise 0.25s ease-out; }
.panel header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.panel h3 { margin: 2px 0; font-size: 18px; }
.panel .x { position: static; }
.panel h4 { margin: 14px 0 6px; font-size: 11.5px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 8px 8px; border-radius: 12px; cursor: pointer; }
.list li:hover { background: rgba(255, 255, 255, 0.07); }
.list .ic { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 10px currentColor; background: currentColor; }
.list .t { flex: 1; min-width: 0; }
.list .t small { display: block; color: var(--muted); font-size: 12px; }
.list .r { font-size: 12px; color: var(--muted); text-align: right; white-space: nowrap; }
.list .empty { color: var(--muted); cursor: default; font-size: 13px; }
.sunline, .moonline { display: flex; align-items: center; gap: 12px; padding: 8px 4px; font-size: 14px; }
.sunline small, .moonline small { display: block; color: var(--muted); font-size: 12px; }
.moonicon { width: 34px; height: 34px; flex: none; }
.toggles { display: grid; grid-template-columns: 1fr; gap: 2px; margin: 6px 0 12px; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 6px; border-radius: 12px; cursor: pointer; }
.toggle:hover { background: rgba(255, 255, 255, 0.05); }
.toggle small { display: block; color: var(--muted); font-size: 12px; }
.sw { position: relative; width: 42px; height: 24px; flex: none; border-radius: 999px; background: rgba(255, 255, 255, 0.14); transition: background 0.2s; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform 0.2s; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); }
.toggle[aria-checked="true"] .sw { background: linear-gradient(135deg, var(--accent), var(--accent2)); }
.toggle[aria-checked="true"] .sw::after { transform: translateX(18px); }
.toggle.locked { opacity: 0.75; }
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: rgba(255, 255, 255, 0.06); margin: 8px 0; flex-wrap: wrap; }
.seg button { flex: 1; border: 0; background: none; padding: 7px 8px; border-radius: 10px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13px; white-space: nowrap; }
.seg button.on { background: rgba(143, 184, 255, 0.22); color: var(--text); }
.bigtime { font-size: 22px; font-weight: 700; margin: 4px 0 10px; }
.bigtime small { display: block; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.lbl { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); flex: 1; }
input[type="datetime-local"], input[type="number"], input[type="search"], input[type="email"], .dlg input, .panel input {
  width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.25); color: var(--text); outline: 0; color-scheme: dark;
}
input:focus { border-color: rgba(143, 184, 255, 0.6); }
.row { display: flex; gap: 8px; align-items: flex-end; margin: 8px 0; }
.row.wrap { flex-wrap: wrap; }
.cities { max-height: 220px; overflow: auto; margin: 6px 0; }
.lock { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 14px; background: rgba(255, 217, 138, 0.08); border: 1px solid rgba(255, 217, 138, 0.25); font-size: 13.5px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: 13px; border: 1px solid rgba(255, 255, 255, 0.16); background: linear-gradient(135deg, rgba(143, 184, 255, 0.5), rgba(201, 162, 255, 0.45)); color: #fff; font-weight: 650; cursor: pointer; white-space: nowrap; }
.btn:hover { filter: brightness(1.12); }
.btn:disabled { opacity: 0.5; cursor: default; filter: none; }
.btn.ghost { background: rgba(255, 255, 255, 0.07); }
.btn.small { padding: 7px 12px; font-size: 13px; border-radius: 11px; }
.btn.hl { background: linear-gradient(135deg, #ffd98a, #ff9fc6); color: #241433; border-color: transparent; }
.btn.warn { background: rgba(255, 120, 120, 0.3); }
.btn.on { background: rgba(255, 217, 138, 0.25); border-color: rgba(255, 217, 138, 0.5); }

/* ---------- dialogs ---------- */
.dlg { width: min(440px, calc(100vw - 24px)); border-radius: 24px; padding: 22px 22px 18px; color: var(--text); background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)), rgba(12, 18, 42, 0.62); }
.dlg::backdrop { background: rgba(2, 4, 12, 0.45); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.dlg[open] { animation: rise 0.25s ease-out; }
.dlg h2 { margin: 0 34px 8px 0; font-size: 22px; display: flex; align-items: center; gap: 10px; }
.grad { background: linear-gradient(90deg, #a9c8ff, #e0b8ff, #ffd98a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: 12.5px; margin: 8px 0; }
.fine.ok, .ok { color: var(--ok); }
.err { color: var(--err); font-size: 13.5px; min-height: 1em; margin: 6px 0; }
.feats { margin: 8px 0 14px; padding: 0; list-style: none; }
.feats li { padding: 7px 0 7px 28px; position: relative; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.feats li::before { content: "✦"; position: absolute; left: 4px; top: 7px; color: var(--gold); }
.feats.tight li { padding: 5px 0 5px 26px; }
.buy .btn { flex: 1; flex-direction: column; gap: 0; padding: 10px; }
.buy .btn small { font-weight: 500; opacity: 0.85; font-size: 11.5px; }
.pro-state { padding: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.05); font-size: 14px; margin: 6px 0; }
.pro-state.on { background: rgba(126, 224, 176, 0.1); border: 1px solid rgba(126, 224, 176, 0.3); }
.a-agree { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.05); cursor: pointer; font-size: 14px; }
.a-agree input { width: 18px; height: 18px; margin-top: 2px; accent-color: #9fb9ff; flex: none; }
.a-methods { display: flex; flex-direction: column; gap: 10px; margin: 10px 0; transition: opacity 0.2s; }
.a-methods.off { opacity: 0.45; pointer-events: none; }
.a-google { min-height: 44px; display: flex; justify-content: center; }
.a-apple { display: flex; align-items: center; justify-content: center; gap: 8px; height: 44px; border-radius: 999px; border: 0; background: #fff; color: #000; font-weight: 600; cursor: pointer; }
.a-or { text-align: center; color: var(--muted); font-size: 12.5px; margin: 2px 0; }
.danger summary { cursor: pointer; color: #ffb3b3; font-size: 13px; margin-top: 12px; }

/* ---------- hint & toast ---------- */
.hint { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 14px 18px; border-radius: 18px; z-index: 7; text-align: center; font-size: 14.5px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: center; max-width: calc(100vw - 32px); }
.toast { position: fixed; left: 50%; bottom: calc(100px + var(--safe-b)); transform: translateX(-50%); padding: 10px 16px; border-radius: 14px; z-index: 9; font-size: 14px; max-width: calc(100vw - 24px); }

/* ---------- small screens: panels and the info card become bottom sheets ---------- */
@media (max-width: 720px) {
  .top { gap: 6px; left: 8px; right: 8px; }
  .brand span, .search kbd { display: none; }
  .brand { padding: 0 9px; }
  .chip { padding: 0 11px; font-size: 13px; }
  .search { padding: 0 10px; }
  #timechip { padding: 0 10px; }
  #timechip #timetxt { max-width: 74px; overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; }
  .acct { width: 44px; padding: 0; justify-content: center; }
  .acct span { display: none; }
  .acct.pro svg { stroke: var(--gold); }
  .grid { gap: 8px 12px; }
  .grid dd { font-size: 13.5px; }
  .info h2 { font-size: 20px; }
  .dock { width: calc(100vw - 16px); justify-content: space-between; border-radius: 20px; }
  .dock button { min-width: 0; flex: 1; padding: 6px 2px 5px; font-size: 10.5px; }
  .dock button svg { width: 21px; height: 21px; }
  .info, .panel { left: 8px; right: 8px; width: auto; top: auto; bottom: calc(84px + var(--safe-b)); max-height: 56vh; border-radius: 22px; }
  .locchip { bottom: calc(86px + var(--safe-b)); left: 8px; }
  .hud { bottom: calc(92px + var(--safe-b)); right: 12px; }
  body.sheet .locchip, body.sheet .hud { display: none; }
}
@media (max-width: 380px) { .search input::placeholder { font-size: 13px; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (max-width: 720px) {
  .results { position: fixed; left: 8px; right: 8px; top: calc(62px + var(--safe-t)); max-height: 55vh; }
}
