:root {
  --bg: #06070f;
  --bg-2: #0a0d1c;
  --card: rgba(17, 21, 38, 0.72);
  --card-solid: #11152a;
  --line: rgba(130, 152, 255, 0.16);
  --line-strong: rgba(130, 152, 255, 0.3);
  --txt: #e9edff;
  --muted: #8d99c2;
  --blue: #6f9bff;
  --violet: #b18cff;
  --cyan: #5ee0ff;
  --pink: #ff8fd0;
  --ok: #4ade80;
  --warn: #fbbf24;
  --radius: 20px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --font: system-ui, -apple-system, "Segoe UI", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--txt);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}

body {
  background:
    radial-gradient(1200px 700px at 12% -10%, rgba(111, 155, 255, 0.14), transparent 60%),
    radial-gradient(1000px 600px at 100% 0%, rgba(177, 140, 255, 0.12), transparent 55%),
    radial-gradient(900px 700px at 50% 110%, rgba(94, 224, 255, 0.08), transparent 60%),
    var(--bg);
  overflow-x: hidden;
}

::selection { background: rgba(111, 155, 255, 0.35); }

.bg-orbs { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.orb { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.5; animation: float 18s ease-in-out infinite alternate; }
.o1 { width: 420px; height: 420px; left: -120px; top: 10%; background: radial-gradient(circle, rgba(111,155,255,.5), transparent 70%); }
.o2 { width: 360px; height: 360px; right: -80px; top: 32%; background: radial-gradient(circle, rgba(177,140,255,.45), transparent 70%); animation-delay: -6s; }
.o3 { width: 300px; height: 300px; left: 38%; bottom: -140px; background: radial-gradient(circle, rgba(94,224,255,.35), transparent 70%); animation-delay: -11s; }
@keyframes float { from { transform: translate3d(0,0,0) scale(1); } to { transform: translate3d(30px,-40px,0) scale(1.12); } }

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em; background: rgba(111,155,255,.1); padding: 2px 6px; border-radius: 6px; color: #bcd0ff; }

/* ---------- 顶部 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px clamp(16px, 4vw, 44px);
  background: rgba(6, 7, 15, 0.72);
  backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--txt); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 42px; height: 42px; display: grid; place-items: center; font-size: 22px;
  border-radius: 13px; background: linear-gradient(135deg, rgba(111,155,255,.28), rgba(177,140,255,.22));
  border: 1px solid var(--line-strong); box-shadow: 0 8px 24px rgba(111,155,255,.22);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 16px; letter-spacing: .3px; }
.brand-text small { color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.pill {
  font-size: 11.5px; color: var(--muted); padding: 6px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(255,255,255,.02);
}

.btn-ghost {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font: inherit; font-size: 13px; color: var(--txt);
  padding: 9px 14px; border-radius: 12px;
  background: rgba(255,255,255,.035); border: 1px solid var(--line);
  transition: all .18s ease;
}
.btn-ghost:hover { border-color: var(--line-strong); background: rgba(255,255,255,.07); text-decoration: none; }
.key-dot { width: 8px; height: 8px; border-radius: 50%; background: #6b7290; box-shadow: 0 0 0 3px rgba(107,114,144,.15); }
.key-dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(74,222,128,.18); }

/* ---------- Tabs ---------- */
.tabs {
  position: relative; z-index: 1;
  display: flex; justify-content: center; gap: 8px;
  padding: 22px 16px 0; flex-wrap: wrap;
}
.tab {
  font: inherit; font-size: 14px; color: var(--muted); cursor: pointer;
  padding: 11px 20px; border-radius: 999px;
  background: transparent; border: 1px solid transparent;
  transition: all .18s ease;
}
.tab:hover { color: var(--txt); background: rgba(255,255,255,.04); }
.tab.active {
  color: #fff; border-color: var(--line-strong);
  background: linear-gradient(135deg, rgba(111,155,255,.2), rgba(177,140,255,.16));
  box-shadow: 0 10px 30px rgba(111,155,255,.16);
}

/* ---------- 布局 ---------- */
.wrap { position: relative; z-index: 1; max-width: 1240px; margin: 0 auto; padding: 24px clamp(16px, 4vw, 32px) 72px; }
.panel { display: none; animation: fadeUp .35s ease; }
.panel.active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.layout { display: grid; grid-template-columns: minmax(0, 430px) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 980px) { .layout { grid-template-columns: 1fr; } }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

/* ---------- 表单 ---------- */
.form { padding: 22px; display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field > label { font-size: 13px; font-weight: 600; letter-spacing: .2px; color: #cfd8ff; display: flex; align-items: center; gap: 6px; }
.req { color: var(--pink); }
.muted { color: var(--muted); font-weight: 400; }
.field label .muted { font-size: 11.5px; }

textarea, select, input[type="text"], input[type="password"] {
  font: inherit; font-size: 14px; color: var(--txt);
  background: rgba(8, 10, 22, 0.7);
  border: 1px solid var(--line); border-radius: 13px;
  padding: 12px 14px; outline: none; width: 100%;
  transition: border-color .18s ease, box-shadow .18s ease;
}
textarea { resize: vertical; min-height: 92px; line-height: 1.6; }
textarea:focus, select:focus, input[type="text"]:focus, input[type="password"]:focus {
  border-color: rgba(111,155,255,.6); box-shadow: 0 0 0 3px rgba(111,155,255,.13);
}
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238d99c2' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
  padding-right: 36px;
}

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chips button {
  font: inherit; font-size: 11.5px; color: var(--muted); cursor: pointer;
  padding: 6px 11px; border-radius: 999px;
  border: 1px dashed rgba(130,152,255,.24); background: transparent;
  transition: all .16s ease;
}
.chips button:hover { color: var(--txt); border-color: var(--blue); background: rgba(111,155,255,.1); }

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg-item {
  font: inherit; text-align: left; cursor: pointer;
  padding: 11px 14px; border-radius: 13px; color: var(--muted);
  background: rgba(8,10,22,.6); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 2px;
  transition: all .18s ease;
}
.seg-item b { font-size: 13.5px; color: var(--txt); font-weight: 600; }
.seg-item small { font-size: 11px; }
.seg-item:hover { border-color: var(--line-strong); }
.seg-item.active {
  border-color: rgba(111,155,255,.65);
  background: linear-gradient(135deg, rgba(111,155,255,.18), rgba(177,140,255,.12));
  box-shadow: 0 0 0 3px rgba(111,155,255,.1) inset;
}

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.advanced { border-top: 1px dashed var(--line); padding-top: 14px; }
.advanced summary { cursor: pointer; font-size: 13px; color: var(--muted); list-style: none; user-select: none; }
.advanced summary::before { content: "▸ "; color: var(--blue); }
.advanced[open] summary::before { content: "▾ "; }
.adv-grid { display: flex; flex-direction: column; gap: 10px; padding-top: 13px; }
.switch { display: flex; align-items: center; gap: 9px; font-size: 13px; color: #c3cdf5; cursor: pointer; }
.switch input { appearance: none; width: 38px; height: 21px; border-radius: 999px; background: rgba(255,255,255,.12); position: relative; cursor: pointer; transition: background .18s ease; flex: none; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; border-radius: 50%; background: #cfd8ff; transition: all .18s ease; }
.switch input:checked { background: linear-gradient(135deg, var(--blue), var(--violet)); }
.switch input:checked::after { left: 20px; background: #fff; }

.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px; cursor: pointer;
  font: inherit; font-size: 15px; font-weight: 650; color: #fff; letter-spacing: .3px;
  padding: 14px 20px; border-radius: 14px; border: 1px solid rgba(190, 210, 255, .28);
  background: linear-gradient(135deg, #5b7cff 0%, #8a6bff 60%, #b18cff 100%);
  box-shadow: 0 14px 34px rgba(91, 124, 255, .32);
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 18px 40px rgba(91,124,255,.42); filter: brightness(1.06); text-decoration: none; }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.btn-primary.small { font-size: 13px; padding: 10px 16px; border-radius: 12px; }
.hint { font-size: 11.5px; color: var(--muted); margin: -4px 0 0; line-height: 1.6; }

/* ---------- 舞台 ---------- */
.stage { min-height: 560px; display: flex; align-items: center; justify-content: center; padding: 22px; position: relative; overflow: hidden; }
.stage-empty, .stage-loading { text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.stage-empty p, .stage-loading p { margin: 4px 0 0; color: #c4cef3; font-size: 14px; }
.stage-empty small, .stage-loading small { font-size: 12px; line-height: 1.7; max-width: 300px; }
.stage-emoji { font-size: 46px; filter: drop-shadow(0 12px 24px rgba(111,155,255,.3)); }

.spinner { width: 44px; height: 44px; border-radius: 50%; border: 3px solid rgba(111,155,255,.18); border-top-color: var(--blue); border-right-color: var(--violet); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.stage-result { width: 100%; display: flex; flex-direction: column; gap: 14px; animation: fadeUp .3s ease; }
.img-frame { border-radius: 16px; overflow: hidden; background: repeating-conic-gradient(#0d1020 0% 25%, #11152a 0% 50%) 50% / 22px 22px; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; min-height: 260px; }
.img-frame img { display: block; width: 100%; height: auto; max-height: 68vh; object-fit: contain; cursor: zoom-in; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 11.5px; color: var(--muted); }
.meta span { padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,.02); }
.meta b { color: #c9d4ff; font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: 9px; }

.hidden { display: none !important; }

/* ---------- 上传 ---------- */
.dropzone {
  border: 1.5px dashed rgba(130,152,255,.3); border-radius: 16px;
  background: rgba(8,10,22,.5); padding: 26px 16px; text-align: center;
  cursor: pointer; transition: all .18s ease; outline: none;
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.drag { border-color: var(--blue); background: rgba(111,155,255,.07); box-shadow: 0 0 0 3px rgba(111,155,255,.1); }
.dz-inner { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--muted); }
.dz-ico { font-size: 26px; }
.dz-inner p { margin: 0; font-size: 13px; color: #c3cdf5; }
.dz-inner small { font-size: 11px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.thumb { position: relative; width: 74px; height: 74px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line-strong); background: #0b0e1c; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .x {
  position: absolute; top: 3px; right: 3px; width: 19px; height: 19px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; line-height: 1; cursor: pointer;
  background: rgba(0,0,0,.66); color: #fff; border: 1px solid rgba(255,255,255,.2);
}
.thumb .idx { position: absolute; left: 3px; bottom: 3px; font-size: 10px; padding: 1px 6px; border-radius: 999px; background: rgba(0,0,0,.66); color: #cfe0ff; }

/* ---------- 历史 ---------- */
.history { margin-top: 22px; }
.history h3 { font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: .4px; margin: 0 0 12px 4px; }
.history-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 12px; }
.h-item { border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: var(--card-solid); cursor: pointer; transition: all .18s ease; }
.h-item:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: 0 12px 26px rgba(0,0,0,.35); }
.h-item img { display: block; width: 100%; aspect-ratio: 1/1; object-fit: cover; }
.h-item .h-meta { padding: 8px 10px; font-size: 10.5px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.h-item .h-meta b { color: #c9d4ff; font-weight: 500; font-size: 11px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 文档 ---------- */
.docs-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
@media (max-width: 980px) { .docs-grid { grid-template-columns: 1fr; } }
.doc { padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.doc.wide { grid-column: 1 / -1; }
.doc h2 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 10px; letter-spacing: .3px; }
.doc h2 .num { width: 26px; height: 26px; display: grid; place-items: center; font-size: 12.5px; border-radius: 9px; background: linear-gradient(135deg, rgba(111,155,255,.3), rgba(177,140,255,.24)); border: 1px solid var(--line-strong); color: #dbe4ff; flex: none; }
.doc p { margin: 0; font-size: 13px; line-height: 1.75; color: #b9c3e6; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 9px; font-size: 13px; line-height: 1.75; color: #b9c3e6; }
.steps li::marker { color: var(--blue); }

.code-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.copy { font: inherit; font-size: 11px; cursor: pointer; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: 3px 9px; }
.copy:hover { color: var(--txt); border-color: var(--line-strong); }
pre.code {
  margin: 0; padding: 14px 16px; border-radius: 12px; overflow: auto;
  background: rgba(4, 6, 14, 0.85); border: 1px solid var(--line);
  font: 12px/1.65 "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #b9c8ff; white-space: pre; tab-size: 2;
}
pre.code code { background: none; padding: 0; color: inherit; font-size: inherit; }

.skills-card { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.02); flex-wrap: wrap; }
.skills-ico { width: 42px; height: 42px; display: grid; place-items: center; font-size: 20px; border-radius: 12px; background: rgba(111,155,255,.12); border: 1px solid var(--line-strong); }
.skills-text { flex: 1 1 160px; display: flex; flex-direction: column; gap: 3px; }
.skills-text b { font-size: 13.5px; }
.skills-text small { font-size: 11px; color: var(--muted); }

.table-wrap { overflow: auto; border-radius: 12px; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th, td { text-align: left; padding: 10px 13px; border-bottom: 1px solid rgba(130,152,255,.09); vertical-align: top; }
th { background: rgba(111,155,255,.06); color: #c8d3ff; font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td { color: #b6c1e4; line-height: 1.6; }

/* ---------- 页脚 ---------- */
.foot { position: relative; z-index: 1; display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap; padding: 26px 16px 40px; font-size: 12px; color: var(--muted); }
.foot .dot { opacity: .4; }

/* ---------- 弹窗 / Toast / 灯箱 ---------- */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; background: rgba(3, 5, 12, .72); backdrop-filter: blur(8px); }
.modal-card { width: min(480px, 100%); background: var(--card-solid); border: 1px solid var(--line-strong); border-radius: 20px; padding: 24px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 13px; animation: fadeUp .25s ease; }
.modal-card h3 { margin: 0; font-size: 16px; }
.modal-card p { margin: 0; font-size: 12.5px; line-height: 1.7; color: var(--muted); }
.modal-card input { margin-top: 2px; }
.modal-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.modal-btns { display: flex; gap: 9px; }
.link { font-size: 12px; }

.toast-wrap { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 9px; align-items: center; pointer-events: none; }
.toast { padding: 11px 18px; border-radius: 12px; font-size: 13px; color: #eaf0ff; background: rgba(24, 30, 54, .95); border: 1px solid var(--line-strong); box-shadow: 0 16px 40px rgba(0,0,0,.45); animation: toastIn .22s ease; max-width: 90vw; }
.toast.err { border-color: rgba(255,120,150,.5); background: rgba(52, 20, 34, .96); }
.toast.ok { border-color: rgba(74,222,128,.45); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(2, 4, 10, .92); display: grid; place-items: center; padding: 22px; cursor: zoom-out; }
.lightbox img { max-width: 96vw; max-height: 92vh; border-radius: 12px; box-shadow: 0 30px 80px rgba(0,0,0,.6); }

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(130,152,255,.22); border-radius: 99px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: rgba(130,152,255,.36); }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 560px) {
  .brand-text small { display: none; }
  .pill { display: none; }
  .stage { min-height: 420px; }
  .row { grid-template-columns: 1fr; }
  .topbar { padding: 12px 14px; }
  .wrap { padding: 20px 14px 56px; }
}
