:root {
  --bg: #0B0B10;
  --fg: #F8FAFC;
  --card: #1E1E23;
  --muted: #232328;
  --muted-fg: #A8B4C4;
  --border: #1E293B;
  --accent: #3B82F6;
  --accent-deep: #1D4ED8;
  --primary: #F8FAFC;
  --on-primary: #0F172A;
  --ring: #F8FAFC;
  --tier-ss: #F4C34A;
  --tier-s: #67E8F9;
  --tier-a: #93C5FD;
  --tier-b: #C5CDD8;
  --tier-f: #F87171;
  --mars: #E36A4A;
  --font-display: "Orbitron", sans-serif;
  --font-body: "Noto Sans SC", "Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", "Noto Sans Mono CJK SC", ui-monospace, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  background: #07070b;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, a { cursor: pointer; }
button { font-family: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 3px; }
img, svg { display: block; }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (prefers-reduced-motion: no-preference) {
  .pulse-glow { animation: pulseGlow 2.8s ease-in-out infinite; }
  .flicker { animation: flicker 1.2s ease-in-out infinite; }
  .twinkle { animation: twinkle 3.6s ease-in-out infinite; }
}
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(59,130,246,0), 0 0 32px rgba(59,130,246,.28); }
  50% { box-shadow: 0 0 0 10px rgba(59,130,246,0), 0 0 48px rgba(59,130,246,.45); }
}
@keyframes flicker { 0%, 100% { opacity: 1; } 50% { opacity: .72; } }
@keyframes twinkle { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }

#app {
  height: 100%;
  max-height: 100%;
  max-width: 430px;
  margin: 0 auto;
  background: var(--bg);
  color: var(--fg);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.body { flex: 1; min-height: 0; position: relative; overflow: hidden; display: flex; flex-direction: column; }
.space-abs { position: absolute; inset: 0; pointer-events: none; }
.hud-label { font-family: var(--font-display); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted-fg); }
.mono { font-family: var(--font-mono); }

.btn {
  min-height: 48px; padding: 0 18px; border-radius: 12px; font-size: 16px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; transition: background 200ms, border-color 200ms, opacity 200ms;
}
.btn-white { background: #F8FAFC; color: #0F172A; }
.btn-white:hover { background: #E2E8F0; }
.btn-blue { background: #1D4ED8; color: #F8FAFC; }
.btn-blue:hover { background: #2563EB; }
.btn-ghost { background: transparent; color: #F8FAFC; border: 1px solid #334155; }
.btn-ghost:hover { border-color: #64748B; }
.btn-gold { background: #F4C34A; color: #0F172A; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }

.tabbar {
  height: auto; min-height: 76px;
  padding: 6px 12px max(18px, env(safe-area-inset-bottom));
  display: flex; background: rgba(11,11,16,.92); border-top: 1px solid #1E293B; z-index: 10; flex-shrink: 0;
}
.tab {
  flex: 1; min-height: 44px; border: 0; background: transparent; color: var(--muted-fg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; font-weight: 500;
}
.tab.active { color: var(--fg); }
.tab.active svg { stroke: #93C5FD; }
.tab svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.login { padding: 8px 28px calc(28px + env(safe-area-inset-bottom)); height: 100%; display: flex; flex-direction: column; position: relative; z-index: 1; }
.login-brand { margin-top: 88px; text-align: center; }
.mark { width: 72px; height: 72px; margin: 0 auto 22px; }
.login-brand h1 { font-size: 32px; font-weight: 700; letter-spacing: .12em; }
.login-brand p { margin-top: 10px; color: var(--muted-fg); font-size: 15px; }
.login-cta { margin-top: auto; display: flex; flex-direction: column; gap: 14px; }
.login-cta .legal { text-align: center; font-size: 12px; color: #94A3B8; line-height: 1.6; }
.dev-box { border: 1px dashed #334155; border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.dev-box .warn { font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #F4C34A; }
.dev-box input {
  min-height: 44px; border-radius: 10px; border: 1px solid #334155; background: #14141a;
  color: var(--fg); padding: 0 12px; font-family: var(--font-mono); font-size: 14px;
}

.home { padding: calc(12px + env(safe-area-inset-top)) 20px 8px; height: 100%; display: flex; flex-direction: column; position: relative; z-index: 1; }
.user-row { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: #1E293B; border: 1px solid #334155; overflow: hidden; flex-shrink: 0; }
.user-row .name { font-weight: 700; font-size: 16px; }
.user-row .handle { font-family: var(--font-mono); font-size: 12px; color: var(--muted-fg); }
.user-row .right { margin-left: auto; text-align: right; }
.traj { background: #14141a; border: 1px solid var(--border); border-radius: 16px; padding: 16px 16px 14px; position: relative; }
.traj .hd { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.traj .days { font-family: var(--font-mono); font-size: 13px; color: #93C5FD; }
.path { position: relative; height: 110px; margin: 4px 0 2px; }
.stats-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0 0; }
.stat { background: #14141a; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.stat .v { font-family: var(--font-mono); font-size: 20px; font-weight: 600; margin-top: 2px; }
.orbs { display: flex; gap: 6px; margin-top: 8px; }
.launch-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.launch-btn {
  width: 188px; height: 188px; min-width: 188px; min-height: 188px;
  border-radius: 50%; border: 2px solid rgba(147,197,253,.55);
  background: radial-gradient(circle at 50% 38%, #2563EB 0%, #1D4ED8 48%, #1E3A8A 100%);
  color: #F8FAFC; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  box-shadow: 0 0 0 8px rgba(29,78,216,.18), 0 0 40px rgba(59,130,246,.28);
}
.launch-btn span { font-size: 26px; font-weight: 700; letter-spacing: .12em; }
.launch-btn small { font-family: var(--font-display); font-size: 9px; letter-spacing: .18em; text-transform: uppercase; color: #BFDBFE; }
.launch-btn:disabled, .launch-btn.is-cool {
  background: radial-gradient(circle at 50% 38%, #334155 0%, #1E293B 55%, #0F172A 100%);
  border-color: #334155; box-shadow: none; color: #CBD5E1; cursor: not-allowed;
}
.launch-btn:disabled small, .launch-btn.is-cool small { color: #94A3B8; }
.ready-hint { margin-top: 16px; color: var(--muted-fg); font-size: 13px; text-align: center; }

.result { height: 100%; display: flex; flex-direction: column; position: relative; }
.hero { height: 292px; position: relative; overflow: hidden; flex-shrink: 0; }
.hero svg { width: 100%; height: 100%; }
.result-body { flex: 1; padding: 8px 22px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; position: relative; z-index: 1; }
.badge { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 700; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; padding: 6px 10px; border-radius: 999px; border: 1px solid currentColor; width: max-content; margin-bottom: 10px; }
.sign-name { font-size: 28px; font-weight: 700; letter-spacing: .08em; margin-bottom: 10px; }
.verse { font-size: 16px; line-height: 1.7; color: #E2E8F0; }
.pay { margin-top: 12px; font-size: 15px; font-weight: 700; }
.delta-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0 18px; }
.delta { background: #14141a; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.delta .v { font-family: var(--font-mono); font-size: 22px; font-weight: 600; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: auto; }

.lb { padding: calc(12px + env(safe-area-inset-top)) 16px 0; height: 100%; display: flex; flex-direction: column; }
.lb h1 { font-size: 20px; font-weight: 700; }
.lb .subhead { color: var(--muted-fg); font-size: 12px; font-family: var(--font-mono); margin: 2px 0 12px; }
.me-card { background: rgba(29,78,216,.16); border: 1px solid #3B82F6; border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
.list { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 4px; position: relative; -webkit-overflow-scrolling: touch; }
.row-item { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 10px; border-radius: 10px; }
.row-item.me { background: rgba(29,78,216,.14); border: 1px solid rgba(59,130,246,.45); }
.rank { width: 28px; font-family: var(--font-mono); font-weight: 600; font-size: 13px; color: var(--muted-fg); text-align: center; }
.rank.g { color: #F4C34A; } .rank.s { color: #C0C7D1; } .rank.b { color: #D19A6C; }
.uname { flex: 1; color: #93C5FD; font-weight: 500; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(147,197,253,.4); background: none; border: 0; font-family: inherit; text-align: left; min-height: 44px; }
.left-days { font-family: var(--font-mono); font-size: 13px; color: var(--fg); }

.inv { padding: calc(12px + env(safe-area-inset-top)) 20px 8px; height: 100%; display: flex; flex-direction: column; position: relative; z-index: 1; overflow: auto; }
.inv h1 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.inv .lead { color: var(--muted-fg); font-size: 14px; line-height: 1.6; margin-bottom: 18px; }
.energy-panel { background: #14141a; border: 1px solid var(--border); border-radius: 16px; padding: 16px; margin-bottom: 16px; }
.energy-panel .count { font-family: var(--font-mono); font-size: 28px; font-weight: 600; }
.link-box { display: flex; align-items: center; gap: 8px; background: #14141a; border: 1px solid var(--border); border-radius: 12px; padding: 6px 6px 6px 14px; margin: 8px 0 12px; }
.link-box code { flex: 1; font-family: var(--font-mono); font-size: 12px; color: #E2E8F0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { width: 44px; height: 44px; min-width: 44px; min-height: 44px; border-radius: 10px; border: 0; background: #1E293B; color: var(--fg); display: flex; align-items: center; justify-content: center; }
.icon-btn svg { width: 18px; height: 18px; }
.full-note { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: rgba(244,195,74,.1); border: 1px solid rgba(244,195,74,.35); color: #F4C34A; font-size: 13px; line-height: 1.6; }
.invited { margin-top: 16px; }
.invited h3 { font-size: 13px; color: var(--muted-fg); margin-bottom: 6px; font-weight: 500; }

#launch-overlay {
  position: absolute; inset: 0; z-index: 40; background: #05050a;
  display: flex; flex-direction: column;
}
#launch-overlay .stage { flex: 1; position: relative; overflow: hidden; }
#launch-overlay .stage svg { width: 100%; height: 100%; }
#launch-overlay .cap {
  position: absolute; left: 0; right: 0; bottom: 28px;
  text-align: center; font-family: var(--font-display); letter-spacing: .18em;
  text-transform: uppercase; font-size: 13px; color: #E2E8F0; text-shadow: 0 1px 8px #000;
  pointer-events: none;
}
#skip-launch {
  position: absolute; top: max(12px, env(safe-area-inset-top)); right: 16px; z-index: 2;
  min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid #334155;
  background: rgba(11,11,16,.72); color: #F8FAFC; font-size: 14px; font-weight: 600;
}
.toast {
  position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%);
  background: #1E1E23; border: 1px solid #334155; color: #F8FAFC;
  padding: 10px 16px; border-radius: 999px; font-size: 13px; z-index: 50;
  white-space: nowrap;
}
.logout {
  margin-top: 8px; background: none; border: 0; color: #64748B; font-size: 12px;
  min-height: 32px; align-self: center;
}

.list-wrap { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; }
.list-fade { position: absolute; bottom: 0; left: 0; right: 0; height: 56px; background: linear-gradient(transparent, var(--bg)); pointer-events: none; }
