:root {
  --bg: #f7f8fc;
  --card: #ffffff;
  --text: #1b2030;
  --muted: #6b7280;
  --line: #e8eaf2;
  --brand: #5b5bf5;
  --brand-2: #8b5cf6;
  --brand-soft: #eef0ff;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(27, 32, 48, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* ---------- Header ---------- */
.header {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.header .container { display: flex; align-items: center; height: 62px; gap: 24px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.logo-mark {
  width: 32px; height: 32px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; display: grid; place-items: center; font-size: 15px; font-weight: 700;
}
.nav { display: flex; gap: 18px; font-size: 14px; color: var(--muted); }
.nav a:hover, .nav a.active { color: var(--brand); }
.nav a.active { font-weight: 600; }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 14px; }

.btn {
  border: 1px solid var(--line); background: #fff; color: var(--text);
  padding: 8px 16px; border-radius: 10px; font-size: 14px; transition: .15s;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; border: none; font-weight: 600;
}
.btn-primary:hover { opacity: .92; color: #fff; }
.btn-lg { padding: 14px 28px; font-size: 16px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.balance-chip {
  background: var(--brand-soft); color: var(--brand);
  padding: 6px 12px; border-radius: 20px; font-size: 13px; font-weight: 600;
}

/* ---------- Hero ---------- */
.hero { padding: 56px 0 30px; text-align: center; }
.hero h1 { font-size: 38px; margin: 0 0 12px; letter-spacing: -0.5px; }
.hero h1 span { background: linear-gradient(135deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); margin: 0 auto 26px; max-width: 620px; font-size: 15px; line-height: 1.7; }

.extractor {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 18px; box-shadow: var(--shadow); max-width: 820px; margin: 0 auto;
}
.extractor textarea {
  width: 100%; min-height: 92px; resize: vertical; border: 1px solid var(--line);
  border-radius: 12px; padding: 14px; font-size: 14px; font-family: inherit; outline: none; color: var(--text);
}
.extractor textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(91, 91, 245, .12); }
.extractor-actions { display: flex; gap: 10px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.tips { color: var(--muted); font-size: 12.5px; margin-top: 10px; text-align: left; }
.tips b { color: var(--brand); cursor: pointer; font-weight: 600; }

/* ---------- Result ---------- */
.result {
  max-width: 820px; margin: 22px auto 0; background: var(--card);
  border: 1px solid var(--line); border-radius: 18px; padding: 18px; box-shadow: var(--shadow); display: none;
}
.result.show { display: block; }
.result-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.result-head .title { font-weight: 600; font-size: 15px; flex: 1; min-width: 200px; }
.tag { font-size: 12px; padding: 3px 10px; border-radius: 20px; background: var(--brand-soft); color: var(--brand); }
.tag-gray { background: #f1f2f7; color: var(--muted); }
.result-text {
  white-space: pre-wrap; line-height: 1.85; font-size: 14.5px; background: #fafbff;
  border: 1px solid var(--line); border-radius: 12px; padding: 14px; max-height: 420px; overflow: auto;
}
.result-meta { margin-top: 12px; color: var(--muted); font-size: 12.5px; display: flex; gap: 14px; flex-wrap: wrap; }
.result-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

.loading { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.spinner {
  width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--brand);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.alert { padding: 12px 14px; border-radius: 12px; font-size: 14px; margin-top: 14px; }
.alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-ok { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }

/* ---------- Sections ---------- */
.section { padding: 46px 0; }
.section h2 { font-size: 26px; margin: 0 0 8px; }
.section .sub { color: var(--muted); font-size: 14px; margin-bottom: 24px; }

.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: 0 4px 14px rgba(27, 32, 48, .04);
}
.card h3 { margin: 0 0 8px; font-size: 16px; }
.card p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.7; }
.card .icon { font-size: 22px; margin-bottom: 10px; }

.price-card { text-align: center; position: relative; }
.price-card .name { font-weight: 600; margin-bottom: 6px; }
.price-card .amount { font-size: 30px; font-weight: 700; color: var(--brand); }
.price-card .amount small { font-size: 14px; color: var(--muted); font-weight: 500; }
.price-card .origin { color: var(--muted); text-decoration: line-through; font-size: 13px; }
.price-card .points { color: var(--muted); font-size: 13px; margin: 8px 0 14px; }
.price-card .bonus { color: var(--warning); font-size: 12.5px; }
.badge-hot {
  position: absolute; top: -10px; right: 12px; background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff; font-size: 11px; padding: 2px 10px; border-radius: 20px;
}

/* ---------- Table ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.table th { color: var(--muted); font-weight: 500; font-size: 13px; }
.table td .ellipsis { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }

/* ---------- Code ---------- */
pre.code {
  background: #1b2030; color: #e5e7eb; border-radius: 12px; padding: 16px;
  overflow: auto; font-size: 13px; line-height: 1.7; margin: 0;
}
pre.code .k { color: #93c5fd; }

/* ---------- Modal ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(17, 20, 30, .5); display: none;
  align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 18px; width: 100%; max-width: 420px; padding: 26px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .2);
}
.modal h3 { margin: 0 0 18px; font-size: 20px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 14px; outline: none; font-family: inherit;
}
.field input:focus { border-color: var(--brand); }
.modal .switch { text-align: center; margin-top: 14px; font-size: 13px; color: var(--muted); }
.modal .switch b { color: var(--brand); cursor: pointer; }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--line); margin-top: 40px; padding: 26px 0;
  color: var(--muted); font-size: 13px; text-align: center; background: #fff;
}
.footer a { color: var(--brand); }

.empty { text-align: center; color: var(--muted); padding: 40px 0; font-size: 14px; }

.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(20px);
  background: #1b2030; color: #fff; padding: 10px 20px; border-radius: 24px; font-size: 14px;
  opacity: 0; transition: .2s; z-index: 80; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 860px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .hero h1 { font-size: 28px; }
  .nav { display: none; }
}
@media (max-width: 560px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
