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

html {
  font-size: clamp(12px, 0.9vw, 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  color: #1e1b4b;
  min-height: 100vh;
  padding: 0;
  background:
    radial-gradient(circle at 20% 20%, #c4b5fd 0%, transparent 40%),
    radial-gradient(circle at 80% 30%, #fbcfe8 0%, transparent 40%),
    radial-gradient(circle at 40% 80%, #a5f3fc 0%, transparent 45%),
    linear-gradient(135deg, #ede9fe 0%, #fce7f3 100%);
  background-attachment: fixed;
}

.top-toolbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 2rem;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.6);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.7rem;
  margin-right: auto;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(124, 58, 237, 0.18);
  color: #4c1d95;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s, transform 0.2s;
}
.status-pill:hover  { background: rgba(255, 255, 255, 0.85); transform: translateY(-1px); }
.status-pill:focus-visible { outline: 2px solid #7c3aed; outline-offset: 2px; }
.status-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #a3a3a3;
  box-shadow: 0 0 0.5rem currentColor;
}
.status-pill.is-online .status-dot  { background: #10b981; color: #10b981; }
.status-pill.is-loading .status-dot { background: #f59e0b; color: #f59e0b; animation: pulse 1.2s infinite; }
.status-pill.is-offline .status-dot { background: #ef4444; color: #ef4444; }

@keyframes pulse { 50% { opacity: 0.35; } }

.container {
  max-width: 75rem;
  margin: 0 auto;
  padding: 2rem 1.875rem 3rem;
}

.capture-wrap {
  padding: 1.5rem;
  border-radius: 1.5rem;
  background:
    radial-gradient(circle at 20% 20%, #c4b5fd 0%, transparent 40%),
    radial-gradient(circle at 80% 30%, #fbcfe8 0%, transparent 40%),
    radial-gradient(circle at 40% 80%, #a5f3fc 0%, transparent 45%),
    linear-gradient(135deg, #ede9fe 0%, #fce7f3 100%);
}

.header {
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 1px solid rgba(255, 255, 255, 0.5);
  padding-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.header-left h1 {
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #4c1d95, #be185d);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  line-height: 1.15;
}
.header-left h1 .emoji {
  background: none;
  -webkit-background-clip: initial;
          background-clip: initial;
  -webkit-text-fill-color: initial;
  color: initial;
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
}
.header-left p {
  margin-top: 0.4rem;
  color: #6b21a8;
  opacity: 0.75;
  font-size: 0.85rem;
}
.header-right { text-align: right; }
.header-right .label {
  font-size: 0.72rem;
  color: #6b21a8;
  opacity: 0.75;
  letter-spacing: 0.5px;
}
.header-right .time {
  margin-top: 0.3rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #4c1d95;
  font-feature-settings: 'tnum';
  font-variant-numeric: tabular-nums;
}
.header-right .accent {
  margin-top: 0.35rem;
  font-size: 1.05rem;
  font-weight: 700;
  background: linear-gradient(135deg, #7c3aed, #ec4899);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  letter-spacing: 0.5px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}
.card {
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 1.25rem;
  padding: 1.5rem;
  transition: transform 0.3s, box-shadow 0.3s, background 0.3s;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 0.75rem 1.875rem rgba(99, 102, 241, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.card:hover {
  transform: translateY(-3px);
  box-shadow:
    0 1.25rem 2.5rem rgba(99, 102, 241, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.6);
}
.card-label {
  font-size: 0.82rem;
  color: #6b21a8;
  opacity: 0.85;
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}
.dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  box-shadow: 0 0 0.5rem currentColor;
}
.dot-orange { background: #f59e0b; color: #f59e0b; }
.dot-blue   { background: #7c3aed; color: #7c3aed; }
.dot-green  { background: #ec4899; color: #ec4899; }

.card-value {
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, #4c1d95, #be185d);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  line-height: 1;
  letter-spacing: -1px;
  font-feature-settings: 'tnum';
  font-variant-numeric: tabular-nums;
}
.card-trend {
  margin-top: 0.7rem;
  font-size: 0.78rem;
  color: #6b21a8;
  opacity: 0.75;
}
.card-bar {
  margin-top: 1rem;
  height: 0.25rem;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 0.125rem;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.6);
}
.card-bar-fill {
  height: 100%;
  width: 0;
  border-radius: 0.125rem;
  transition: width 0.6s;
  box-shadow: 0 0 0.5rem currentColor;
}
.fill-orange { background: linear-gradient(90deg, #f59e0b, #f97316); }
.fill-blue   { background: linear-gradient(90deg, #7c3aed, #6366f1); }
.fill-green  { background: linear-gradient(90deg, #ec4899, #f472b6); width: 100%; }

.section {
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-radius: 1.5rem;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow:
    0 1.25rem 3.125rem rgba(99, 102, 241, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.section-header {
  padding: 1.5rem 2rem;
  background: rgba(255, 255, 255, 0.3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.5);
}
.section-header h2 {
  font-size: 1.55rem;
  font-weight: 700;
  background: linear-gradient(135deg, #7c3aed, #ec4899);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  display: flex;
  align-items: center;
  gap: 0.625rem;
}
.section-header h2::before {
  content: '';
  width: 0.625rem;
  height: 0.625rem;
  background: linear-gradient(135deg, #7c3aed, #ec4899);
  border-radius: 50%;
  box-shadow: 0 0 0.75rem rgba(124, 58, 237, 0.5);
}
.section-header p {
  font-size: 1rem;
  color: #6b21a8;
  margin-top: 0.35rem;
  margin-left: 1.5rem;
  opacity: 0.8;
}

.btn {
  padding: 0.5rem 1.125rem;
  border: 1px solid rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.5);
  color: #4c1d95;
  border-radius: 0.75rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.25s, transform 0.25s, box-shadow 0.25s;
  backdrop-filter: blur(8px);
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}
.btn:hover {
  background: rgba(255, 255, 255, 0.8);
  transform: translateY(-1px);
  box-shadow: 0 0.375rem 1rem rgba(124, 58, 237, 0.15);
}
.btn:disabled {
  opacity: 0.6;
  cursor: progress;
  transform: none;
}
.btn:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
}
.btn.primary {
  background: linear-gradient(135deg, #7c3aed, #ec4899);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 0.25rem 0.875rem rgba(124, 58, 237, 0.4);
}
.btn.primary:hover {
  box-shadow: 0 0.5rem 1.25rem rgba(124, 58, 237, 0.5);
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 1.1rem 1rem;
  text-align: center;
  background: rgba(124, 58, 237, 0.10);
  font-size: 1.05rem;
  color: #6b21a8;
  font-weight: 700;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(124, 58, 237, 0.25);
}
thead th.right { text-align: center; }
tbody td {
  padding: 1.2rem 1rem;
  border-top: 1px solid rgba(124, 58, 237, 0.15);
  font-size: 1.2rem;
  line-height: 1.4;
  color: #1e1b4b;
  transition: background 0.2s;
  text-align: center;
  vertical-align: middle;
}
tbody tr:nth-child(odd)  td { background: rgba(255, 255, 255, 0.18); }
tbody tr:nth-child(even) td { background: rgba(167, 139, 250, 0.12); }
tbody td.right { text-align: center; }
tbody tr:hover td { background: rgba(255, 255, 255, 0.55); }

.cat-name,
.num {
  font-size: 1.2rem;
  line-height: 1.4;
  font-weight: 600;
  font-family: -apple-system, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-feature-settings: 'tnum';
  font-variant-numeric: tabular-nums;
}
.cat-name      { color: #4c1d95; }
.num.zero      { color: #c4b5fd; opacity: 0.5; }

tfoot td {
  padding: 1.4rem 1rem;
  background: rgba(124, 58, 237, 0.18);
  color: #4c1d95;
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1.4;
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border-top: 2px solid rgba(124, 58, 237, 0.3);
  text-align: center;
}
tfoot td.right {
  text-align: center;
  font-size: 1.25rem;
  color: #4c1d95;
}

.ratio-col {
  text-align: center;
  width: 14rem;
  padding-left: 1rem !important;
}
.ratio-cell {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  align-items: center;
}
.pct {
  color: #4c1d95;
  font-weight: 700;
  font-size: 0.95rem;
  font-feature-settings: 'tnum';
  font-variant-numeric: tabular-nums;
}
.ratio-bar {
  width: 11rem;
  height: 0.7rem;
  background: #e9e2ff;
  border-radius: 100px;
  overflow: hidden;
  display: block;
  border: 1px solid rgba(124, 58, 237, 0.25);
  position: relative;
}
.ratio-fill {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #7c3aed, #ec4899);
  border-radius: 100px;
  transition: width 0.5s;
  box-shadow: 0 0 0.5rem rgba(124, 58, 237, 0.45);
  min-width: 0.25rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%) translateY(150%);
  background: rgba(76, 29, 149, 0.94);
  color: #fff;
  padding: 0.6rem 1.2rem;
  border-radius: 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 0.5rem 1.5rem rgba(76, 29, 149, 0.35);
  z-index: 200;
  transition: transform 0.35s;
  pointer-events: none;
  max-width: 90vw;
}
.toast.is-show { transform: translateX(-50%) translateY(0); }
.toast.is-error { background: rgba(190, 24, 93, 0.94); box-shadow: 0 0.5rem 1.5rem rgba(190, 24, 93, 0.35); }

body.capturing .top-toolbar { visibility: hidden; }
body.capturing .toast       { visibility: hidden; }

@media (max-width: 768px) {
  html { font-size: 14px; }
  .container    { padding: 1rem 1rem 2rem; }
  .top-toolbar  { padding: 0.5rem 1rem; }
  .cards        { grid-template-columns: 1fr; }
  .header       { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .header-left h1 { font-size: 1.6rem; }
  thead th,
  tbody td,
  tfoot td      { padding: 0.75rem 0.5rem; }
  .ratio-col    { padding-left: 0.5rem !important; width: auto; }
  .ratio-bar    { width: 7rem; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
