:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: #ffffff;
  --surface-muted: #f8fafc;
  --text: #0f172a;
  --muted: #667085;
  --line: rgba(148, 163, 184, 0.24);
  --accent: #2563eb;
  --accent-2: #14b8a6;
  --accent-soft: rgba(37, 99, 235, 0.1);
  --success: #059669;
  --warning: #b45309;
  --danger: #dc2626;
  --shadow: 0 14px 44px rgba(15, 23, 42, 0.08);
  --radius-xl: 22px;
  --radius-lg: 18px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --mono: "SFMono-Regular", "JetBrains Mono", Consolas, monospace;
  --sans:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #07111f;
  --surface: rgba(15, 23, 42, 0.78);
  --surface-strong: #111827;
  --surface-muted: #0b1220;
  --text: #e5edf7;
  --muted: #9aa7b7;
  --line: rgba(148, 163, 184, 0.2);
  --accent: #60a5fa;
  --accent-2: #2dd4bf;
  --accent-soft: rgba(96, 165, 250, 0.14);
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
}

code {
  font-family: var(--mono);
}

.page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 8% 0%, rgba(37, 99, 235, 0.18), transparent 27rem),
    radial-gradient(circle at 92% 8%, rgba(20, 184, 166, 0.16), transparent 25rem),
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), transparent 38%),
    var(--bg);
}

[data-theme="dark"] .page-bg {
  background:
    radial-gradient(circle at 8% 0%, rgba(96, 165, 250, 0.22), transparent 27rem),
    radial-gradient(circle at 92% 8%, rgba(45, 212, 191, 0.18), transparent 25rem),
    linear-gradient(180deg, rgba(15, 23, 42, 0.72), transparent 42%),
    var(--bg);
}

.app-shell {
  width: min(1240px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 14px 0 30px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 850;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 13px;
  background: linear-gradient(135deg, #0f172a, var(--accent));
  color: white;
  font-size: 13px;
  letter-spacing: -0.04em;
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.22);
}

.toolbar {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.segmented,
.theme-toggle {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
  backdrop-filter: blur(14px);
}

.segmented {
  display: inline-flex;
  padding: 3px;
}

.segmented-button,
.theme-toggle {
  min-height: 34px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.segmented-button {
  min-width: 42px;
  border-radius: 999px;
  background: transparent;
}

.segmented-button.is-active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
}

.theme-icon {
  color: var(--accent);
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.78fr) minmax(0, 1.22fr);
  gap: 12px;
}

.panel,
.stat-card,
.subpanel {
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 16px;
  overflow: hidden;
  position: relative;
  border-radius: var(--radius-xl);
  padding: clamp(20px, 3vw, 30px);
}

.hero::after {
  content: "";
  position: absolute;
  right: -58px;
  bottom: -82px;
  width: 178px;
  height: 178px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.16), rgba(20, 184, 166, 0.16));
}

.hero-copy,
.hero-actions {
  position: relative;
  z-index: 1;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: clamp(34px, 4vw, 52px);
  line-height: 1;
  letter-spacing: -0.055em;
}

.hero-text {
  max-width: 56ch;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.hero-actions,
.dropzone-actions,
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}

.stats-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  padding: 15px 16px;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.stat-card::after {
  content: "";
  position: absolute;
  inset: auto -20px -32px auto;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: var(--accent-soft);
}

.has-data .stat-card {
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: 0 24px 70px rgba(37, 99, 235, 0.14);
}

.has-data .stat-valid {
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.14), rgba(20, 184, 166, 0.12)),
    var(--surface);
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.stat-value {
  display: block;
  margin-top: 6px;
  font-size: clamp(30px, 3.4vw, 42px);
  line-height: 0.9;
  letter-spacing: -0.06em;
}

.panel {
  border-radius: var(--radius-xl);
  padding: 16px;
}

.panel-head,
.result-head,
.subpanel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.panel-head h2,
.result-head h2,
.subpanel h3 {
  margin: 0;
  letter-spacing: -0.035em;
}

.panel-head p,
#summary-text {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.dropzone {
  display: grid;
  min-height: 238px;
  margin-top: 16px;
  place-items: center;
  gap: 8px;
  border: 1.5px dashed rgba(37, 99, 235, 0.36);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(37, 99, 235, 0.08), rgba(255, 255, 255, 0.18)),
    var(--surface-muted);
  padding: 20px;
  text-align: center;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.dropzone.drag-active {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 16px 34px rgba(37, 99, 235, 0.16);
}

.dropzone input {
  display: none;
}

.dropzone-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  font-size: 24px;
  line-height: 1;
}

.dropzone-title {
  color: var(--text);
  font-size: 20px;
  font-weight: 850;
  letter-spacing: -0.03em;
}

.dropzone-subtitle {
  max-width: 32ch;
  color: var(--muted);
  line-height: 1.5;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.mode-button {
  display: grid;
  gap: 4px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  color: var(--text);
  cursor: pointer;
  padding: 12px;
  text-align: left;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
}

.mode-button:hover {
  transform: translateY(-1px);
}

.mode-button.is-active {
  border-color: rgba(37, 99, 235, 0.48);
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.11), rgba(20, 184, 166, 0.09)),
    var(--surface-strong);
  box-shadow: 0 14px 34px rgba(37, 99, 235, 0.12);
}

.mode-title {
  overflow: hidden;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mode-desc {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

[hidden] {
  display: none !important;
}

.field {
  display: grid;
  gap: 6px;
}

.field-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 780;
}

.field-input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  color: var(--text);
  padding: 9px 11px;
}

.field-input:focus {
  border-color: rgba(37, 99, 235, 0.58);
  outline: 4px solid rgba(37, 99, 235, 0.13);
}

.check-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  color: var(--muted);
  padding: 9px 11px;
}

.check-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.hint {
  position: relative;
  display: inline-grid;
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--accent);
  cursor: help;
  font-size: 11px;
  font-weight: 900;
}

.hint::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  z-index: 20;
  width: min(260px, 72vw);
  transform: translateX(-50%) translateY(4px);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-strong);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.18);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
  opacity: 0;
  padding: 10px 11px;
  pointer-events: none;
  text-transform: none;
  transition:
    opacity 120ms ease,
    transform 120ms ease;
}

.hint:hover::after,
.hint:focus::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 850;
  gap: 8px;
  padding: 9px 15px;
  text-decoration: none;
  transition:
    transform 140ms ease,
    opacity 140ms ease,
    box-shadow 140ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.button-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.22);
}

.button-secondary {
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--text);
}

.results-panel {
  grid-column: 1 / -1;
}

.result-actions {
  justify-content: flex-end;
}

.results-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: 14px;
  margin-top: 16px;
}

.subpanel {
  border-radius: var(--radius-lg);
  padding: 14px;
}

.subpanel-head span,
#copy-status {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.account-list {
  display: grid;
  max-height: 360px;
  gap: 10px;
  margin-top: 12px;
  overflow: auto;
}

.account-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  padding: 12px;
}

.account-name {
  min-width: 0;
  overflow: hidden;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-source {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.pill {
  max-width: 190px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  padding: 5px 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.issue-list {
  display: grid;
  max-height: 360px;
  gap: 8px;
  margin: 12px 0 0;
  overflow: auto;
  padding: 0;
  list-style: none;
}

.issue-list li {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  color: var(--muted);
  line-height: 1.5;
  padding: 10px 11px;
}

.issue-list li[data-level="error"] {
  border-color: rgba(220, 38, 38, 0.24);
  background: color-mix(in srgb, var(--danger), transparent 91%);
  color: #be123c;
}

[data-theme="dark"] .issue-list li[data-level="error"] {
  color: #fda4af;
}

.issue-list li[data-level="warning"] {
  border-color: rgba(180, 83, 9, 0.26);
  background: color-mix(in srgb, var(--warning), transparent 91%);
  color: #92400e;
}

[data-theme="dark"] .issue-list li[data-level="warning"] {
  color: #fcd34d;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  color: var(--muted);
  padding: 18px;
  text-align: center;
}

.output-panel {
  margin-top: 14px;
}

#copy-status {
  min-height: 20px;
  color: var(--success);
}

.json-preview {
  max-height: 440px;
  margin: 12px 0 0;
  overflow: auto;
  border: 1px solid rgba(96, 165, 250, 0.22);
  border-radius: var(--radius-md);
  background: #0b1120;
  color: #dbeafe;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.58;
  padding: 14px;
}

.json-preview code {
  display: block;
  min-width: 0;
}

.json-key {
  color: #93c5fd;
}

.json-string {
  color: #86efac;
}

.json-number {
  color: #fcd34d;
}

.json-boolean {
  color: #f9a8d4;
}

.json-null {
  color: #c4b5fd;
}

@media (max-width: 980px) {
  .layout,
  .hero,
  .results-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hero-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(calc(100% - 20px), 1240px);
    padding-top: 12px;
  }

  .topbar,
  .panel-head,
  .result-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar,
  .hero-actions,
  .result-actions,
  .dropzone-actions,
  .button {
    width: 100%;
  }

  .toolbar {
    flex-wrap: wrap;
  }

  .hero-actions,
  .dropzone-actions,
  .result-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .stats-grid,
  .settings-grid,
  .mode-switch {
    grid-template-columns: 1fr;
  }

  .hero,
  .panel {
    padding: 16px;
  }

  .dropzone {
    min-height: 220px;
    padding: 18px 14px;
  }

  .account-card {
    grid-template-columns: 1fr;
  }

  .account-meta {
    justify-content: flex-start;
  }

  .pill {
    max-width: 100%;
  }

  .json-preview {
    white-space: pre-wrap;
    word-break: break-word;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
