:root {
  --bg: #070b14;
  --bg2: #0c1220;
  --card: #111827ee;
  --line: #1f2a3d;
  --text: #e8eef7;
  --muted: #8b9bb4;
  --gold: #fbbf24;
  --gold-soft: #fef3c7;
  --cyan: #22d3ee;
  --blue: #3b82f6;
  --green: #22c55e;
  --violet: #a78bfa;
  --orange: #fb923c;
  --pink: #f472b6;
  --danger: #f87171;
  --radius: 18px;
  --font: "Space Grotesk", "Noto Sans TC","Noto Sans SC", system-ui, sans-serif;
  --shadow: 0 20px 50px #0008;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, #1e3a8a55, transparent 60%),
    radial-gradient(900px 500px at 90% 10%, #7c2d1244, transparent 55%),
    radial-gradient(800px 500px at 50% 100%, #312e8155, transparent 50%),
    var(--bg);
  line-height: 1.45;
}

#app { max-width: 1180px; margin: 0 auto; padding: 16px 16px 48px; }

.topbar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  justify-content: space-between; margin-bottom: 16px;
  padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px;
  background: #0b1220cc; backdrop-filter: blur(10px); position: sticky; top: 10px; z-index: 40;
}
.brand { display: flex; gap: 10px; align-items: center; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; color: #0b1220; font-size: 14px;
  background: linear-gradient(135deg, var(--gold), #f59e0b);
  box-shadow: 0 0 18px #fbbf2488;
}
.brand strong { font-size: 1.15rem; letter-spacing: 0.02em; display: block; line-height: 1.1; }
.brand-sub { color: var(--muted); font-size: 0.75rem; }
.topbar-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.date-switch {
  display: flex; align-items: center; gap: 8px; font-size: 0.78rem; color: var(--muted);
  background: #0a1020; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px 4px 12px;
}
.date-switch select {
  background: transparent; color: var(--text); border: 0; font: inherit; outline: none; cursor: pointer;
}

.btn {
  border: 1px solid var(--line); background: #152033; color: var(--text);
  border-radius: 999px; padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
.btn:hover { transform: translateY(-1px); border-color: #334155; }
.btn.primary {
  background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #111827; border-color: transparent;
}
.btn.ghost { background: transparent; }

.layout { display: grid; gap: 16px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 18px 16px; box-shadow: var(--shadow); backdrop-filter: blur(8px);
}

.hero h1 {
  margin: 0 0 6px; font-size: clamp(1.45rem, 3.5vw, 2.1rem); letter-spacing: -0.02em;
}
.tagline { margin: 0 0 16px; color: var(--cyan); font-weight: 600; }
.steps {
  list-style: none; margin: 0 0 14px; padding: 0;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.steps li {
  display: flex; gap: 10px; align-items: flex-start;
  background: #0a1220; border: 1px solid var(--line); border-radius: 14px; padding: 12px;
}
.steps span {
  width: 28px; height: 28px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; font-weight: 700; font-size: 0.85rem;
  background: linear-gradient(135deg, #38bdf8, #6366f1); color: white;
}
.steps b { display: block; font-size: 0.95rem; }
.steps small { color: var(--muted); }
.hero-note { margin: 0; color: var(--muted); font-size: 0.9rem; }

.universe-head { margin-bottom: 10px; }
.universe-head.row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: end; }
.universe-head h2 { margin: 0 0 4px; font-size: 1.15rem; }
.universe-head p { margin: 0; color: var(--muted); font-size: 0.88rem; }

.universe-stage {
  position: relative; border-radius: 16px; overflow: hidden;
  background:
    radial-gradient(circle at 80% 30%, #7c2d1233, transparent 35%),
    radial-gradient(circle at 20% 15%, #1d4ed833, transparent 40%),
    linear-gradient(180deg, #050814, #0a1020 60%, #0b1324);
  border: 1px solid #1e293b;
}
#universeSvg { width: 100%; height: auto; display: block; min-height: 280px; }
.planet { cursor: default; transition: opacity .25s ease, filter .25s ease; }
.planet.dim { opacity: 0.28; filter: grayscale(0.6); }
.planet.active { opacity: 1; filter: none; }
.planet-label { fill: #f8fafc; font-size: 13px; font-weight: 700; font-family: var(--font); }
.planet-sub { fill: #cbd5e1; font-size: 10px; font-family: var(--font); }
.arrow-caption { font-size: 11px; font-family: var(--font); opacity: 0.85; }

.legend {
  display: flex; flex-wrap: wrap; gap: 12px 18px; margin-top: 12px;
  color: var(--muted); font-size: 0.8rem;
}
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg {
  width: 12px; height: 12px; border-radius: 50%; display: inline-block;
  border: 1.5px solid transparent;
}
.lg.driver { background: #fff; border-color: var(--gold); }
.lg.pax { background: #60a5fa; }
.lg.grape { background: linear-gradient(135deg, #a78bfa, #38bdf8); }
.lg.pop { background: var(--gold); box-shadow: 0 0 8px #fbbf24aa; }

.tooltip {
  position: absolute; z-index: 5; pointer-events: none;
  background: #0f172acc; color: #fff; border: 1px solid #334155;
  border-radius: 10px; padding: 8px 10px; font-size: 0.78rem; max-width: 220px;
  backdrop-filter: blur(8px); transform: translate(-50%, -120%);
}

/* Tunnel */
.tunnel-stage {
  position: relative; min-height: 220px; border-radius: 16px; overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 50%, #0ea5e922, transparent 45%),
    radial-gradient(circle at 50% 50%, #020617 0%, #020617 18%, #0b1220 55%, #111827 100%);
  border: 1px solid #1e293b; perspective: 900px;
}
.tunnel-rail {
  position: absolute; inset: 10% 8%;
  border: 1px dashed #33415588; border-radius: 50%;
  box-shadow: inset 0 0 60px #22d3ee22, 0 0 40px #0008;
}
.tunnel-days {
  position: relative; height: 220px; display: grid; place-items: center;
}
.day-node {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: var(--size); height: var(--size);
  border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; cursor: pointer; border: 2px solid var(--ring, #38bdf8);
  background: radial-gradient(circle at 35% 30%, #ffffff22, #0b1220ee);
  color: var(--text); opacity: var(--op, 1);
  box-shadow: 0 0 calc(var(--glow, 12) * 1px) var(--ring, #38bdf8aa);
  transition: transform .2s ease, opacity .2s ease, box-shadow .2s ease;
  font-size: clamp(0.65rem, calc(var(--size) * 0.12), 0.9rem);
  font-weight: 700; text-align: center; padding: 4px;
  z-index: var(--z, 1);
}
.day-node:hover, .day-node:focus-visible {
  outline: none; transform: translate(-50%, -50%) scale(1.06);
}
.day-node.active {
  border-color: var(--gold); box-shadow: 0 0 28px #fbbf24aa;
}
.day-node.far { pointer-events: none; }
.day-node small { font-weight: 500; color: var(--muted); font-size: 0.7em; }
.day-node .count {
  font-size: 0.7em; background: #0ea5e9; color: white; border-radius: 999px;
  padding: 1px 6px; margin-top: 2px;
}
.tunnel-hint { margin-top: 10px; color: var(--muted); font-size: 0.82rem; }

.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: #0b1220; color: var(--muted);
  border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 0.8rem; cursor: pointer;
}
.chip.active { color: #0b1220; background: var(--gold); border-color: transparent; font-weight: 700; }

.cluster-board {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-top: 12px;
}
.cluster-card {
  background: #0a1220; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px;
  position: relative; overflow: hidden;
}
.cluster-card::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 4px;
  background: var(--accent, var(--cyan));
}
.cluster-card h3 { margin: 0 0 4px; font-size: 0.95rem; }
.cluster-card .meta { color: var(--muted); font-size: 0.78rem; margin-bottom: 10px; }
.grape {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; min-height: 64px;
}
.bubble {
  border-radius: 999px; padding: 8px 10px; font-size: 0.72rem; line-height: 1.2;
  max-width: 160px; border: 1.5px solid transparent; cursor: default;
  box-shadow: 0 6px 16px #0005; transition: transform .15s ease;
}
.bubble:hover { transform: scale(1.04); }
.bubble.driver {
  background: #fff; color: #111827; border-color: var(--gold);
  font-weight: 600; box-shadow: 0 0 0 1px #fbbf2444, 0 8px 20px #fbbf2433;
}
.bubble.pax { color: #0b1220; font-weight: 500; }
.bubble.pax.c0 { background: #93c5fd; }
.bubble.pax.c1 { background: #86efac; }
.bubble.pax.c2 { background: #f9a8d4; }
.bubble.pax.c3 { background: #c4b5fd; }
.bubble.pax.c4 { background: #fdba74; }
.seats {
  margin-top: 10px; display: flex; gap: 4px; align-items: center; font-size: 0.75rem; color: var(--muted);
}
.seat {
  width: 14px; height: 14px; border-radius: 4px; border: 1px solid #475569; background: #1e293b;
}
.seat.filled { background: var(--gold); border-color: var(--gold); }
.badge-weekly {
  display: inline-block; margin-left: 6px; font-size: 0.68rem; padding: 1px 6px;
  border-radius: 999px; background: #312e81; color: #c4b5fd; vertical-align: middle;
}

.site-foot {
  margin-top: 28px; text-align: center; color: var(--muted); font-size: 0.8rem;
}
.site-foot p { margin: 4px 0; }

.modal {
  border: 1px solid var(--line); border-radius: 18px; padding: 0; width: min(420px, calc(100vw - 24px));
  background: #0f172a; color: var(--text); box-shadow: var(--shadow);
}
.modal::backdrop { background: #020617cc; backdrop-filter: blur(4px); }
.modal form { padding: 18px; display: grid; gap: 12px; }
.modal h3 { margin: 0; }
.modal label { display: grid; gap: 6px; font-size: 0.88rem; }
.modal input[type="text"], .modal input:not([type]), .modal select {
  width: 100%; border-radius: 10px; border: 1px solid var(--line);
  background: #020617; color: var(--text); padding: 10px 12px; font: inherit;
}
.modal fieldset {
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 6px;
}
.modal fieldset label { display: flex; align-items: center; gap: 8px; }
.modal .check { display: flex; align-items: center; gap: 8px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: 0.8rem; }

@media (max-width: 720px) {
  .steps { grid-template-columns: 1fr; }
  .topbar { border-radius: 18px; }
  .tunnel-stage, .tunnel-days { min-height: 260px; height: 260px; }
}

/* Language switcher */
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.55);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.lang-switch a {
  color: #94a3b8;
  text-decoration: none;
  padding: 2px 4px;
}
.lang-switch a:hover { color: #e2e8f0; }
.lang-switch a.active {
  color: #fbbf24;
}
.lang-switch .sep { color: #475569; user-select: none; }
