:root {
  --bg: #070b16;
  --bg-2: #0d1424;
  --card: rgba(255, 255, 255, 0.045);
  --card-line: rgba(255, 255, 255, 0.09);
  --text: #e8eefc;
  --muted: #93a2c0;
  --accent: #38bdf8;
  --accent-2: #a78bfa;
  --good: #34d399;
  --bad: #f87171;
  --radius: 18px;
  --maxw: 880px;
}

* { box-sizing: border-box; }

/* author display rules must never resurrect a [hidden] section */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 620px at 12% -8%, rgba(56, 189, 248, 0.13), transparent 60%),
    radial-gradient(900px 560px at 92% 4%, rgba(167, 139, 250, 0.14), transparent 62%),
    var(--bg);
  color: var(--text);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "SF Pro TC", "PingFang HK", "Noto Sans TC", "Helvetica Neue", Arial, sans-serif;
  padding: max(18px, env(safe-area-inset-top)) 16px calc(40px + env(safe-area-inset-bottom));
}

.wrap { max-width: var(--maxw); margin: 0 auto; }

/* ── hero ─────────────────────────────────────────────── */
.hero { text-align: center; padding: 26px 4px 20px; }
.hero-art { width: 62px; height: 62px; margin: 0 auto 14px; }
.hero-art svg { width: 100%; height: 100%; }
h1 {
  font-size: clamp(26px, 7vw, 38px);
  line-height: 1.18;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
  font-weight: 700;
}
.lede { color: var(--muted); margin: 0 auto 14px; max-width: 34em; font-size: 15px; }
.badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: #bfe6ff;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.22);
  padding: 7px 13px; border-radius: 999px; margin: 0;
}
.badge svg { width: 15px; height: 15px; }

/* ── upload ───────────────────────────────────────────── */
.drop {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  margin: 22px 0 18px; padding: 30px 18px;
  border: 1.5px dashed rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  cursor: pointer; text-align: center;
  transition: border-color .18s, background .18s, transform .18s;
}
.drop:hover, .drop.over {
  border-color: rgba(56, 189, 248, 0.55);
  background: linear-gradient(180deg, rgba(56,189,248,0.12), rgba(167,139,250,0.06));
  transform: translateY(-1px);
}
.drop-icon { width: 34px; height: 34px; color: var(--accent); margin-bottom: 4px; }
.drop-icon svg { width: 100%; height: 100%; }
.drop b { font-size: 16.5px; }
.drop small { color: var(--muted); font-size: 12.5px; }

.steps { list-style: none; display: grid; gap: 9px; padding: 0; margin: 0 0 20px; }
.steps li {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--card); border: 1px solid var(--card-line);
  border-radius: 14px; padding: 12px 14px;
}
.steps b {
  flex: 0 0 22px; height: 22px; width: 22px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12.5px;
  background: linear-gradient(135deg, rgba(56,189,248,.28), rgba(167,139,250,.3));
  border: 1px solid rgba(255,255,255,.16);
}
.steps div { font-size: 14px; color: #cfdaf0; }

/* ── error / faq ──────────────────────────────────────── */
.err {
  border: 1px solid rgba(248, 113, 113, 0.42);
  background: rgba(248, 113, 113, 0.1);
  border-radius: 14px; padding: 14px 16px; margin: 0 0 16px;
}
.err h2 { margin: 0 0 6px; font-size: 15.5px; color: #fecaca; }
.err p { margin: 0; font-size: 13.5px; color: #f3c9c9; }

.faq {
  border: 1px solid var(--card-line); border-radius: 12px;
  background: var(--card); padding: 0 14px; margin-bottom: 9px;
}
.faq summary { cursor: pointer; padding: 12px 0; font-size: 14px; font-weight: 600; }
.faq p { margin: 0 0 12px; font-size: 13.5px; color: var(--muted); }

.foot { color: #6b7a96; font-size: 12px; text-align: center; margin: 22px 0 0; }

/* ── busy ─────────────────────────────────────────────── */
#busy { display: grid; place-items: center; min-height: 74vh; }
.busy-box { position: relative; text-align: center; width: 100%; max-width: 340px; padding: 20px; }
.ring { width: 132px; height: 132px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(255,255,255,0.09); stroke-width: 5; }
.ring-fg {
  fill: none; stroke: url(#g); stroke: var(--accent); stroke-width: 5; stroke-linecap: round;
  transition: stroke-dashoffset .25s linear;
}
.pct {
  position: absolute; left: 0; right: 0; top: 66px;
  font-size: 30px; font-weight: 700; letter-spacing: -0.02em;
}
.pct small { font-size: 13px; color: var(--muted); margin-left: 2px; }
.busy-box h2 { margin: 18px 0 6px; font-size: 16px; }
.busy-box p { margin: 0; color: var(--muted); font-size: 13px; }

/* ── dashboard chrome ─────────────────────────────────── */
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.topbar h1 { font-size: 24px; margin: 0; }
.meta { color: var(--muted); font-size: 12px; margin: 4px 0 0; }
.ghost {
  flex: 0 0 auto; background: transparent; color: #bcd0ef;
  border: 1px solid rgba(255,255,255,.16); border-radius: 10px;
  padding: 8px 12px; font-size: 12.5px; cursor: pointer;
}
.ghost:hover { border-color: rgba(56,189,248,.5); color: #e6f4ff; }

.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  flex: 0 0 auto; background: var(--card); color: var(--muted);
  border: 1px solid var(--card-line); border-radius: 999px;
  padding: 8px 15px; font-size: 13.5px; cursor: pointer; white-space: nowrap;
}
.tabs button[aria-selected="true"] {
  color: #06121f; font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
}

.ranges { display: flex; gap: 6px; margin-bottom: 16px; }
.ranges button {
  background: transparent; color: var(--muted); border: 1px solid var(--card-line);
  border-radius: 9px; padding: 6px 12px; font-size: 12.5px; cursor: pointer;
}
.ranges button[aria-selected="true"] { color: var(--text); border-color: rgba(56,189,248,.55); background: rgba(56,189,248,.1); }

/* ── cards / tiles ────────────────────────────────────── */
.card {
  background: var(--card); border: 1px solid var(--card-line);
  border-radius: var(--radius); padding: 15px 16px 17px; margin-bottom: 13px;
  backdrop-filter: blur(8px);
}
.card h3 { margin: 0 0 11px; font-size: 14px; font-weight: 650; color: #d8e4f8; letter-spacing: 0.01em; }
.note { margin: 9px 0 0; font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.empty {
  display: grid; place-items: center; min-height: 84px;
  color: var(--muted); font-size: 13px; text-align: center;
  border: 1px dashed rgba(255,255,255,.12); border-radius: 12px;
}

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 9px; }
.tiles.tight { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.tile {
  background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.07);
  border-radius: 13px; padding: 11px 12px;
}
.tile .k { font-size: 11.5px; color: var(--muted); margin-bottom: 3px; }
.tile .v { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.tile .s { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.insights { margin: 0; padding-left: 18px; }
.insights li { font-size: 13.5px; color: #cfdaf0; margin-bottom: 7px; }

/* ── charts ───────────────────────────────────────────── */
.chart { width: 100%; height: 170px; display: block; overflow: visible; }
.chart .grid { stroke: rgba(255,255,255,.06); stroke-width: 1; }
.chart .bar { fill: rgba(56,189,248,.85); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart .dot { fill: #0b1220; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart .tick { fill: #7f8fab; font-size: 11px; }
.chart-foot { font-size: 11.5px; color: var(--muted); margin-top: 6px; }

.weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.wd { text-align: center; }
.wdbar { height: 74px; display: flex; align-items: flex-end; justify-content: center; }
.wdbar i { display: block; width: 66%; border-radius: 5px 5px 2px 2px; background: linear-gradient(180deg, var(--accent), rgba(56,189,248,.35)); }
.wd span { display: block; font-size: 10.5px; color: var(--muted); margin-top: 4px; }
.wd b { display: block; font-size: 11.5px; font-weight: 600; }

.stages { display: grid; gap: 9px; }
.stage { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 9px; font-size: 12.5px; }
.stage .track { height: 9px; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden; }
.stage .track i { display: block; height: 100%; border-radius: 999px; }
.stage b { font-weight: 600; color: #cfdaf0; white-space: nowrap; }

/* ── tables / lists ───────────────────────────────────── */
.scroll { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th, .tbl td { text-align: left; padding: 7px 8px; border-bottom: 1px solid rgba(255,255,255,.07); white-space: nowrap; }
.tbl th { color: var(--muted); font-weight: 600; font-size: 11.5px; }
.tbl td:nth-child(n+2), .tbl th:nth-child(n+2) { text-align: right; }

.list { list-style: none; margin: 0; padding: 0; }
.list li {
  display: grid; grid-template-columns: 1.4fr 1fr .7fr .8fr 1fr; gap: 8px;
  font-size: 12.5px; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.06);
  color: #cfdaf0;
}
.list li b { font-weight: 600; }
.list li span { color: var(--muted); text-align: right; }
.list li span:first-of-type { text-align: left; }

.delta { font-weight: 600; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }

@media (max-width: 420px) {
  .list li { grid-template-columns: 1.2fr 1fr .8fr; }
  .list li span:nth-child(n+4) { display: none; }
  .chart { height: 150px; }
}
