:root {
  --bg: #060a14;
  --bg-soft: #0b1222;
  --panel: rgba(15, 23, 40, 0.72);
  --panel-solid: #0f1728;
  --border: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(148, 163, 184, 0.28);
  --text: #e9eefb;
  --muted: #8b9ab6;
  --muted-dim: #64748b;
  --brand: #8b5cf6;
  --brand-2: #22d3ee;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #fb7185;
  --radius: 16px;
  --mono: "JetBrains Mono", "SFMono-Regular", "Cascadia Code", Consolas, "Liberation Mono", Menlo, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: rgba(139, 92, 246, 0.35); }

code, pre, textarea, select { font-family: var(--mono); }

/* ---------------------------------------------------------------- 背景 */
.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(76, 29, 149, 0.35), transparent 65%),
    linear-gradient(180deg, #070b16 0%, #060a14 45%, #050810 100%);
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.45;
  animation: float 18s ease-in-out infinite alternate;
}
.blob-a { width: 520px; height: 520px; left: -160px; top: -180px; background: #4c1d95; }
.blob-b { width: 460px; height: 460px; right: -120px; top: 60px; background: #0e7490; animation-delay: -6s; }
.blob-c { width: 380px; height: 380px; left: 38%; top: 42%; background: #1e3a8a; opacity: 0.28; animation-delay: -12s; }

@keyframes float {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(40px, 30px, 0) scale(1.12); }
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.045) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 70% 55% at 50% 0%, #000 10%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 70% 55% at 50% 0%, #000 10%, transparent 80%);
}

/* ---------------------------------------------------------------- 顶栏 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  background: rgba(6, 10, 20, 0.72);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.logo-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #7c3aed, #06b6d4);
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 15px; letter-spacing: 0.01em; }
.brand-text small { font-size: 11px; color: var(--muted); letter-spacing: 0.08em; }

.header-right { display: flex; align-items: center; gap: 14px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--muted);
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.05);
  white-space: nowrap;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted-dim);
  display: inline-block;
}
.dot.live { background: var(--ok); box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.14); }
.dot.ok { background: var(--ok); }
.dot.info { background: var(--brand-2); }
.dot.brand { background: var(--brand); }
.dot.warn { background: var(--warn); }

.ghost-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 12.5px;
  padding: 6px 10px;
  border-radius: 8px;
  transition: 0.2s;
}
.ghost-link:hover { color: var(--text); background: rgba(148, 163, 184, 0.1); }

/* ---------------------------------------------------------------- 布局 */
.page {
  max-width: 1240px;
  margin: 0 auto;
  padding: 54px 24px 40px;
}

.hero { text-align: center; max-width: 820px; margin: 0 auto 36px; }

.hero-badge {
  display: inline-block;
  font-size: 11.5px;
  letter-spacing: 0.12em;
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.35);
  background: rgba(139, 92, 246, 0.1);
  padding: 5px 14px;
  border-radius: 999px;
  margin-bottom: 20px;
}

.hero h1 {
  margin: 0 0 16px;
  font-size: clamp(30px, 4.4vw, 50px);
  line-height: 1.12;
  letter-spacing: -0.025em;
  font-weight: 700;
}

.grad {
  background: linear-gradient(100deg, #a78bfa 10%, #22d3ee 55%, #67e8f9 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding-left: 0.12em;
}

.hero-sub {
  margin: 0 auto;
  max-width: 660px;
  color: var(--muted);
  font-size: 14.5px;
}

.hero-sub code {
  font-size: 12.5px;
  color: #c4b5fd;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 5px;
  padding: 1px 5px;
}

.hero-tags {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.hero-tags span {
  font-size: 11.5px;
  color: var(--muted-dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
}

/* ---------------------------------------------------------------- 主卡片 */
.app-card {
  background: linear-gradient(180deg, rgba(20, 29, 49, 0.88), rgba(11, 18, 34, 0.92));
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow:
    0 30px 80px -30px rgba(0, 0, 0, 0.8),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.toolbar {
  display: flex;
  align-items: flex-end;
  gap: 22px;
  flex-wrap: wrap;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  background: rgba(148, 163, 184, 0.03);
}

.lang-picker { display: flex; flex-direction: column; gap: 6px; min-width: 210px; }
.lang-picker > label {
  font-size: 11px;
  color: var(--muted-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.select-shell { position: relative; }

.select-shell select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-width: 210px;
  padding: 10px 36px 10px 13px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: rgba(8, 13, 25, 0.9);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: 0.18s;
}
.select-shell select:hover { border-color: rgba(139, 92, 246, 0.55); }
.select-shell select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
}
.select-shell svg {
  position: absolute;
  right: 11px;
  top: 50%;
  width: 15px;
  height: 15px;
  transform: translateY(-50%);
  stroke: var(--muted);
  fill: none;
  stroke-width: 2;
  pointer-events: none;
}

.options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding-bottom: 2px;
  flex: 1 1 520px;
  min-width: 0;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 12.5px;
  color: var(--muted);
  transition: color 0.18s;
}
.switch:hover { color: var(--text); }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }

.switch .track {
  position: relative;
  width: 30px;
  height: 17px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.22);
  border: 1px solid rgba(148, 163, 184, 0.16);
  transition: 0.2s;
  flex: none;
}
.switch .track::after {
  content: "";
  position: absolute;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #cbd5e1;
  top: 2px;
  left: 2px;
  transition: 0.2s;
}
.switch input:checked + .track {
  background: linear-gradient(90deg, rgba(124, 58, 237, 0.9), rgba(6, 182, 212, 0.85));
  border-color: transparent;
}
.switch input:checked + .track::after { left: 15px; background: #fff; }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25); }

.toolbar-actions { display: flex; gap: 10px; margin-left: auto; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 10px 17px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--sans);
  cursor: pointer;
  transition: 0.18s;
  white-space: nowrap;
}
.btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn.ghost {
  color: var(--muted);
  border-color: var(--border-strong);
  background: rgba(148, 163, 184, 0.06);
}
.btn.ghost:hover { color: var(--text); border-color: rgba(148, 163, 184, 0.4); background: rgba(148, 163, 184, 0.12); }

.btn.primary {
  color: #fff;
  background: linear-gradient(135deg, #7c3aed 0%, #6366f1 45%, #06b6d4 100%);
  box-shadow: 0 10px 26px -8px rgba(99, 102, 241, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.24);
}
.btn.primary:hover { transform: translateY(-1px); box-shadow: 0 14px 32px -8px rgba(99, 102, 241, 0.85); }
.btn.primary:active { transform: translateY(0); }
.btn.primary:disabled, .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.btn.loading svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- Tabs */
.tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 22px 0;
  border-bottom: 1px solid var(--border);
}

.tab {
  position: relative;
  border: none;
  background: none;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  padding: 9px 14px 12px;
  cursor: pointer;
  transition: color 0.18s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); }
.tab.active::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
}

.tab-hint {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted-dim);
  font-family: var(--mono);
}

/* ---------------------------------------------------------------- 编辑器 */
.panel { padding: 18px 22px 20px; }
.hidden { display: none !important; }

.editors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.editor {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(5, 9, 18, 0.62);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s;
}
.editor:focus-within { border-color: rgba(139, 92, 246, 0.45); }
.editor.output:focus-within { border-color: rgba(34, 211, 238, 0.4); }

.editor-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(148, 163, 184, 0.04);
  min-height: 42px;
}

.editor-title {
  font-size: 12px;
  font-weight: 600;
  color: #cbd5e1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.editor-meta { font-size: 11px; color: var(--muted-dim); font-family: var(--mono); }

.editor-tools { margin-left: auto; display: flex; gap: 6px; }

.mini-btn {
  border: 1px solid var(--border);
  background: rgba(148, 163, 184, 0.06);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 11.5px;
  padding: 4px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: 0.16s;
  white-space: nowrap;
}
.mini-btn:hover { color: var(--text); border-color: var(--border-strong); background: rgba(148, 163, 184, 0.12); }

.lang-badge {
  font-size: 10.5px;
  font-weight: 500;
  color: #a5f3fc;
  background: rgba(34, 211, 238, 0.12);
  border: 1px solid rgba(34, 211, 238, 0.3);
  border-radius: 999px;
  padding: 1px 8px;
}

.editor-body {
  display: flex;
  height: clamp(320px, 44vh, 540px);
  background:
    radial-gradient(ellipse 120% 80% at 0% 0%, rgba(139, 92, 246, 0.06), transparent 60%),
    transparent;
}

.gutter {
  margin: 0;
  padding: 14px 8px 14px 0;
  min-width: 46px;
  text-align: right;
  font-size: 13px;
  line-height: 1.7;
  color: #3f4b63;
  background: rgba(148, 163, 184, 0.03);
  border-right: 1px solid rgba(148, 163, 184, 0.07);
  overflow: hidden;
  user-select: none;
  flex: none;
  white-space: pre;
}

.editor textarea {
  flex: 1;
  width: 100%;
  resize: none;
  border: none;
  outline: none;
  background: transparent;
  color: #dbe6f9;
  padding: 14px 14px 14px 12px;
  font-size: 13px;
  line-height: 1.7;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
  caret-color: #a78bfa;
}
.editor textarea::placeholder { color: #475569; }
.editor textarea::-webkit-scrollbar { width: 10px; height: 10px; }
.editor textarea::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.2);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: padding-box;
}
.editor textarea::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.35); background-clip: padding-box; }
.editor textarea::-webkit-scrollbar-corner { background: transparent; }

.output textarea { color: #b9f6e0; }

/* ---------------------------------------------------------------- 统计 */
.stats {
  margin-top: 14px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(148, 163, 184, 0.04);
  font-size: 12px;
  color: var(--muted);
  min-height: 42px;
}
.stats.empty .stat { display: none; }
.stats:not(.empty) .stats-placeholder { display: none; }

.stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.07);
  border: 1px solid var(--border);
}
.stat b { color: var(--text); font-weight: 600; font-family: var(--mono); font-size: 11.5px; }

/* ---------------------------------------------------------------- 批量 */
.dropzone {
  border: 1.5px dashed rgba(148, 163, 184, 0.3);
  border-radius: var(--radius);
  padding: 38px 20px;
  text-align: center;
  cursor: pointer;
  transition: 0.2s;
  background: rgba(148, 163, 184, 0.025);
}
.dropzone:hover, .dropzone.dragover {
  border-color: rgba(139, 92, 246, 0.65);
  background: rgba(139, 92, 246, 0.07);
}
.dropzone svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: #a78bfa;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  margin-bottom: 10px;
}
.dropzone p { margin: 0 0 4px; font-size: 13.5px; color: var(--text); }
.dropzone small { color: var(--muted-dim); font-size: 11.5px; }
.dropzone .link { color: #a78bfa; text-decoration: underline; text-underline-offset: 2px; }

.file-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 300px;
  overflow: auto;
}
.file-list:empty { display: none; }

.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.04);
  font-size: 12.5px;
}
.file-item .fname { font-family: var(--mono); color: #dbe6f9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item .fsize { color: var(--muted-dim); font-size: 11px; margin-left: auto; font-family: var(--mono); }
.file-item .fremove {
  border: none;
  background: none;
  color: var(--muted-dim);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 6px;
}
.file-item .fremove:hover { color: var(--danger); background: rgba(251, 113, 133, 0.1); }

.batch-bar {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}
.batch-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }

/* ---------------------------------------------------------------- 信息卡 */
.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 22px;
}

.info-card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(13, 20, 36, 0.6);
  transition: 0.2s;
}
.info-card:hover { border-color: rgba(139, 92, 246, 0.35); transform: translateY(-2px); }
.info-card h3 {
  margin: 0 0 8px;
  font-size: 13.5px;
  color: #ddd6fe;
  font-weight: 600;
}
.info-card p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.75; }
.info-card code {
  font-size: 11.5px;
  background: rgba(148, 163, 184, 0.1);
  border-radius: 4px;
  padding: 1px 4px;
  color: #cbd5e1;
}

/* ---------------------------------------------------------------- API */
.api-card {
  margin-top: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(13, 20, 36, 0.6);
  padding: 20px 22px;
  scroll-margin-top: 90px;
}
.api-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.api-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.api-code {
  margin: 0;
  padding: 16px 18px;
  border-radius: 12px;
  background: rgba(2, 6, 16, 0.75);
  border: 1px solid var(--border);
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.75;
  color: #a5b4fc;
}

/* ---------------------------------------------------------------- 页脚 / Toast */
.site-footer {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 24px 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  font-size: 11.5px;
  color: var(--muted-dim);
}
.footer-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--muted-dim); }

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 100;
  padding: 11px 16px;
  border-radius: 11px;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid var(--border-strong);
  box-shadow: 0 18px 50px -12px rgba(0, 0, 0, 0.8);
  font-size: 12.5px;
  color: var(--text);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: 0.25s;
  max-width: 360px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: rgba(251, 113, 133, 0.45); color: #fecdd3; }
.toast.success { border-color: rgba(52, 211, 153, 0.4); color: #a7f3d0; }

/* ---------------------------------------------------------------- 响应式 */
@media (max-width: 980px) {
  .editors { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
  .editor-body { height: clamp(240px, 38vh, 400px); }
  .toolbar { align-items: stretch; }
  .toolbar-actions { margin-left: 0; width: 100%; }
  .toolbar-actions .btn { flex: 1; }
  .header-right .pill { display: none; }
}

@media (max-width: 620px) {
  .page { padding: 32px 14px 30px; }
  .header-inner { padding: 10px 16px; }
  .panel { padding: 14px; }
  .toolbar { padding: 14px; gap: 14px; }
  .options { gap: 6px 12px; }
  .tab-hint { display: none; }
  .site-footer { flex-wrap: wrap; }
  .brand-text small { display: none; }
}
