/* ============================================================
   星屑通行证 —— 二次元夜空主题
   纯 CSS + 内联 SVG 角色，不依赖任何外部图片
   ============================================================ */
:root {
  --bg: #141029;
  --ink: #eae6ff;
  --ink-soft: rgba(234, 230, 255, .72);
  --ink-dim: rgba(234, 230, 255, .42);
  --cyan: #8be9fd;
  --pink: #ff79c6;
  --violet: #bd93f9;
  --mint: #7ef0b8;
  --glass: rgba(255, 255, 255, .075);
  --glass-2: rgba(255, 255, 255, .11);
  --line: rgba(255, 255, 255, .12);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Noto Sans SC", "Microsoft YaHei", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  display: flex;
  justify-content: center;
  padding: clamp(16px, 4vw, 44px) 16px 24px;
}

/* ============================ 背景 ============================ */
.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% 0%, #241a44 0%, #191334 45%, #100d22 100%);
}

.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .55;
}
.glow--a {
  width: 46vw; height: 46vw; min-width: 320px; min-height: 320px;
  left: -10vw; top: -12vh;
  background: radial-gradient(circle, rgba(139, 233, 253, .55), transparent 68%);
}
.glow--b {
  width: 52vw; height: 52vw; min-width: 360px; min-height: 360px;
  right: -14vw; bottom: -16vh;
  background: radial-gradient(circle, rgba(255, 121, 198, .5), transparent 68%);
}
.glow--c {
  width: 38vw; height: 38vw; min-width: 260px; min-height: 260px;
  right: 8vw; top: 6vh;
  background: radial-gradient(circle, rgba(189, 147, 249, .42), transparent 70%);
}

.starfield {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.4px 1.4px at 18% 24%, rgba(255,255,255,.9), transparent 60%),
    radial-gradient(1.2px 1.2px at 72% 16%, rgba(255,255,255,.75), transparent 60%),
    radial-gradient(1.6px 1.6px at 44% 62%, rgba(255,255,255,.7), transparent 60%),
    radial-gradient(1.1px 1.1px at 86% 48%, rgba(255,255,255,.8), transparent 60%),
    radial-gradient(1.3px 1.3px at 12% 78%, rgba(255,255,255,.65), transparent 60%),
    radial-gradient(1.5px 1.5px at 62% 86%, rgba(255,255,255,.7), transparent 60%),
    radial-gradient(1px 1px at 34% 40%, rgba(255,255,255,.55), transparent 60%),
    radial-gradient(1px 1px at 92% 78%, rgba(255,255,255,.5), transparent 60%);
  background-size: 100% 100%;
  animation: twinkle 7s ease-in-out infinite alternate;
}

.sparkles i {
  position: absolute;
  width: 10px; height: 10px;
  background: #fff;
  clip-path: polygon(50% 0%, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0% 50%, 40% 40%);
  opacity: .0;
  animation: spark 4.5s ease-in-out infinite;
}

/* 流星 */
.comet {
  position: absolute;
  height: 2px;
  width: 150px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, rgba(139, 233, 253, .95), rgba(255, 255, 255, .9));
  opacity: 0;
  filter: drop-shadow(0 0 6px rgba(139, 233, 253, .8));
  animation: comet 11s linear infinite;
}
.comet--1 { top: 14%; left: -12%; animation-delay: 2s; }
.comet--2 { top: 52%; left: -18%; width: 190px; animation-delay: 7.5s; }

/* ============================ Q版角色 ============================ */
.chibi {
  position: absolute;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 18px 30px rgba(6, 3, 24, .55));
  animation: float 7s ease-in-out infinite;
}
.chibi svg { display: block; width: 100%; height: auto; }

.chibi--a { width: 238px; left: -16px; bottom: -22px; animation-duration: 7.5s; }
.chibi--b { width: 198px; right: -14px; bottom: 34px; opacity: .95; animation-duration: 8.6s; animation-delay: -1.8s; }
.chibi--c {
  width: 158px; right: 4%; top: 32px; opacity: .62;
  animation-duration: 9.8s; animation-delay: -3.2s;
  filter: blur(.4px) drop-shadow(0 18px 30px rgba(6, 3, 24, .45));
}
.chibi--c svg { transform: rotate(-4deg); }

.chibi--d {
  width: 146px; left: 3.5%; top: 22px; opacity: .58;
  animation-duration: 10.4s; animation-delay: -2.1s;
  filter: blur(.4px) drop-shadow(0 18px 30px rgba(6, 3, 24, .45));
}
.chibi--d svg { transform: rotate(4deg); }

/* 眼睛偶尔眨一下 */
.eyes {
  transform-box: fill-box;
  transform-origin: center;
  animation: blink 6.4s ease-in-out infinite;
}

/* ============================ 主体 ============================ */
.stage {
  width: 100%;
  max-width: 470px;
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 6px 4px;
}
.brand-star {
  font-size: 18px;
  line-height: 1;
  color: var(--cyan);
  text-shadow: 0 0 14px rgba(139, 233, 253, .75);
}
.brand-txt { display: flex; flex-direction: column; line-height: 1.3; }
.brand-txt strong {
  font-size: 15px;
  letter-spacing: .12em;
  font-weight: 600;
  background: linear-gradient(90deg, #fff, var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-txt em {
  font-style: normal;
  font-size: 11px;
  letter-spacing: .14em;
  color: var(--ink-dim);
}

/* 玻璃面板 */
.panel {
  position: relative;
  padding: 24px 22px 20px;
  border-radius: 28px;
  background: linear-gradient(165deg, rgba(255, 255, 255, .12), rgba(255, 255, 255, .035));
  border: 1px solid var(--line);
  box-shadow:
    0 30px 70px -24px rgba(3, 1, 18, .95),
    inset 0 1px 0 rgba(255, 255, 255, .2);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  overflow: hidden;
}
.panel::before {
  content: "";
  position: absolute; left: 12%; right: 12%; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(139, 233, 253, .85), rgba(255, 121, 198, .7), transparent);
}
.panel--center { text-align: center; padding: 38px 24px 32px; }

.panel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.kicker {
  font-size: 11px;
  letter-spacing: .2em;
  color: var(--ink-dim);
}
.tag {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  color: var(--cyan);
  background: rgba(139, 233, 253, .12);
  border: 1px solid rgba(139, 233, 253, .28);
  white-space: nowrap;
}

h1 { font-size: 20px; font-weight: 700; }
.dest {
  margin-top: 8px;
  font-size: 27px;
  line-height: 1.25;
  letter-spacing: .01em;
  word-break: break-word;
  text-shadow: 0 0 26px rgba(139, 233, 253, .25);
}
.sub {
  margin-top: 6px;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--ink-soft);
}
.sub--dim { color: var(--ink-dim); font-size: 11.5px; }

/* 倒计时 */
.timer {
  margin-top: 18px;
  padding: 18px 16px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .08);
  text-align: center;
}
.timer-label {
  font-size: 11px;
  letter-spacing: .22em;
  color: var(--ink-dim);
}
.timer-value {
  margin: 2px 0 12px;
  font-family: var(--mono);
  font-size: clamp(46px, 13vw, 62px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #ffffff 10%, var(--cyan) 55%, var(--pink) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 18px rgba(139, 233, 253, .35));
}
.timer-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  overflow: hidden;
}
.timer-track > i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--violet), var(--pink));
  box-shadow: 0 0 14px rgba(139, 233, 253, .7);
  transition: width .4s linear;
}
.timer-note {
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--ink-dim);
}
.timer-note b { color: var(--ink-soft); font-weight: 600; font-variant-numeric: tabular-nums; }

/* 分隔 */
.divider {
  position: relative;
  height: 1px;
  margin: 18px 0 14px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .18), transparent);
}
.divider span {
  position: absolute; left: 50%; top: 50%;
  width: 5px; height: 5px;
  transform: translate(-50%, -50%) rotate(45deg);
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
}

/* 线路 */
.lanes-head {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 10px;
}
.lanes-head strong { font-size: 13.5px; letter-spacing: .04em; }
.lanes-head span { font-size: 11.5px; color: var(--ink-dim); }

.lanes { list-style: none; display: flex; flex-direction: column; gap: 9px; }

.line {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 10px 10px 11px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .1);
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease, background .2s ease;
}
.line:hover {
  background: rgba(255, 255, 255, .08);
  border-color: rgba(139, 233, 253, .45);
  box-shadow: 0 10px 26px -12px rgba(139, 233, 253, .6);
  transform: translateY(-1px);
}
.line.is-picked {
  border-color: rgba(255, 121, 198, .7);
  box-shadow: 0 0 0 1px rgba(255, 121, 198, .28), 0 12px 30px -14px rgba(255, 121, 198, .75);
}
.line.is-busy { opacity: .55; pointer-events: none; }

.line-idx {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: 11px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--cyan);
  background: rgba(139, 233, 253, .1);
  border: 1px solid rgba(139, 233, 253, .22);
}
.line-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.line-main b { font-size: 14px; font-weight: 600; letter-spacing: .01em; }
.line-main em {
  font-style: normal;
  font-size: 11.5px;
  color: var(--ink-dim);
}

/* 按钮 */
button { font: inherit; cursor: pointer; border: 0; }

.btn-ghost {
  flex: 0 0 auto;
  padding: 8px 13px;
  border-radius: 12px;
  font-size: 12.5px;
  color: var(--cyan);
  background: transparent;
  border: 1px solid rgba(139, 233, 253, .38);
  transition: background .18s ease, border-color .18s ease;
}
.btn-ghost:hover { background: rgba(139, 233, 253, .14); border-color: rgba(139, 233, 253, .7); }

.btn-solid {
  flex: 0 0 auto;
  padding: 8px 16px;
  border-radius: 12px;
  font-size: 12.5px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--pink), var(--violet));
  box-shadow: 0 8px 20px -6px rgba(255, 121, 198, .7);
  transition: filter .18s ease, transform .12s ease;
}
.btn-solid:hover { filter: brightness(1.08); }
.btn-solid:active { transform: translateY(1px); }

.btn {
  padding: 11px 18px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
}
.btn--primary {
  color: #fff;
  background: linear-gradient(135deg, var(--pink), var(--violet));
  box-shadow: 0 12px 28px -10px rgba(255, 121, 198, .85);
}
.btn--primary:hover { filter: brightness(1.07); }
.btn--wide { display: block; width: 100%; max-width: 220px; margin: 20px auto 0; }

.fine {
  margin-top: 14px;
  font-size: 11px;
  line-height: 1.7;
  color: var(--ink-dim);
}

/* 状态图标 */
.ring {
  width: 42px; height: 42px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--cyan), var(--violet), var(--pink), var(--cyan));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 0);
  mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 0);
  animation: spin 1s linear infinite;
}
.orb {
  width: 54px; height: 54px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 22px;
  font-weight: 800;
  color: #ffd6a5;
  background: radial-gradient(circle at 30% 25%, rgba(255, 209, 165, .3), rgba(255, 121, 198, .16));
  border: 1px solid rgba(255, 209, 165, .45);
  box-shadow: 0 0 26px rgba(255, 160, 122, .35), inset 0 0 18px rgba(255, 209, 165, .18);
}

.foot {
  text-align: center;
  padding: 6px 0 2px;
  font-size: 11px;
  letter-spacing: .1em;
  color: rgba(234, 230, 255, .3);
}

/* 视图切换 */
.view { display: none; }
body[data-state="loading"] [data-view="loading"],
body[data-state="ready"] [data-view="ready"],
body[data-state="invalid"] [data-view="invalid"],
body[data-state="error"] [data-view="error"] { display: block; }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 16px);
  max-width: calc(100vw - 36px);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 12.5px;
  color: #fff;
  background: rgba(24, 18, 46, .92);
  border: 1px solid rgba(139, 233, 253, .3);
  box-shadow: 0 14px 36px -12px rgba(0, 0, 0, .9), 0 0 22px -8px rgba(139, 233, 253, .6);
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
  z-index: 30;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ============================ 动画 ============================ */
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-.6deg); }
  50% { transform: translateY(-14px) rotate(.6deg); }
}
@keyframes blink {
  0%, 92%, 100% { transform: scaleY(1); }
  95% { transform: scaleY(.1); }
}
@keyframes twinkle {
  from { opacity: .55; }
  to { opacity: 1; }
}
@keyframes spark {
  0%, 100% { opacity: 0; transform: scale(.3) rotate(0deg); }
  40% { opacity: .95; transform: scale(1) rotate(45deg); }
  70% { opacity: .2; transform: scale(.6) rotate(80deg); }
}
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes comet {
  0% { opacity: 0; transform: translate3d(0, 0, 0) rotate(26deg); }
  6% { opacity: 1; }
  26% { opacity: 0; transform: translate3d(122vw, 58vh, 0) rotate(26deg); }
  100% { opacity: 0; transform: translate3d(122vw, 58vh, 0) rotate(26deg); }
}

/* ============================ 响应式 ============================ */
@media (max-width: 560px) {
  .chibi--a { width: 152px; left: -34px; bottom: -26px; }
  .chibi--b { width: 132px; right: -30px; bottom: 6px; }
  /* 手机上远景角色会和标题挤在一起，直接收起来 */
  .chibi--c, .chibi--d { display: none; }
  .comet { display: none; }
  .panel { padding: 20px 16px 18px; border-radius: 24px; }
  .dest { font-size: 23px; }
  .timer { padding: 16px 12px 14px; }
  .line { padding: 9px 9px 9px 10px; gap: 9px; }
  .btn-ghost { padding: 8px 10px; }
  .btn-solid { padding: 8px 12px; }
  .foot { padding-bottom: 96px; }
}

@media (max-height: 700px) {
  .chibi--c, .chibi--d { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .chibi, .eyes, .starfield, .sparkles i, .ring { animation: none; }
  .timer-track > i, .line, .toast { transition: none; }
}
