/* ============================================================================
   开发者工具箱 · 样式
   深色工作台风格：墨蓝底 + 卡片网格 + 一点冷光
   ========================================================================== */

:root{
  --bg:#070a10;
  --bg-soft:#0b1119;
  --panel:#0e1520;
  --card:#111926;
  --card-hi:#16202f;
  --line:rgba(255,255,255,.07);
  --line-hi:rgba(255,255,255,.14);
  --txt:#e8eef8;
  --txt-2:#9aa8bd;
  --txt-3:#5f6d82;
  --accent:#4f8cff;
  --accent-2:#7c5cff;
  --green:#3ddc97;
  --amber:#e8a55a;
  --red:#ff6b6b;
  --mono:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;
  --sans:-apple-system,BlinkMacSystemFont,"PingFang SC","Hiragino Sans GB","Microsoft YaHei",system-ui,sans-serif;
}

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

html{-webkit-text-size-adjust:100%}

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

/* 背景光晕 */
body::before{
  content:"";
  position:fixed;
  inset:0;
  background:
    radial-gradient(1000px 520px at 50% -12%, rgba(79,140,255,.18), transparent 68%),
    radial-gradient(760px 420px at 88% 6%, rgba(124,92,255,.10), transparent 70%),
    radial-gradient(700px 500px at 8% 30%, rgba(61,220,151,.05), transparent 72%);
  pointer-events:none;
  z-index:0;
}

/* 细网格 */
body::after{
  content:"";
  position:fixed;
  inset:0;
  background-image:
    linear-gradient(rgba(255,255,255,.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.022) 1px, transparent 1px);
  background-size:64px 64px;
  mask-image:radial-gradient(900px 600px at 50% 0%, #000 20%, transparent 78%);
  -webkit-mask-image:radial-gradient(900px 600px at 50% 0%, #000 20%, transparent 78%);
  pointer-events:none;
  z-index:0;
}

/* ── 顶栏 ── */
.topbar{
  position:sticky;
  top:0;
  z-index:50;
  height:56px;
  display:flex;
  align-items:center;
  gap:16px;
  padding:0 22px;
  background:rgba(7,10,16,.78);
  backdrop-filter:blur(14px) saturate(140%);
  -webkit-backdrop-filter:blur(14px) saturate(140%);
  border-bottom:1px solid var(--line);
}

.brand{
  display:flex;
  align-items:center;
  gap:10px;
  text-decoration:none;
  color:var(--txt);
  flex-shrink:0;
}

.brand-mark{
  width:26px;
  height:26px;
  border-radius:8px;
  display:grid;
  place-items:center;
  background:linear-gradient(150deg,var(--accent),var(--accent-2));
  color:#fff;
  font-family:var(--mono);
  font-size:15px;
  font-weight:700;
  box-shadow:0 4px 14px rgba(79,140,255,.35);
}

.brand-name{font-size:14px;font-weight:600;letter-spacing:.2px}

.topbar-spacer{flex:1}

.topbar-right{display:flex;align-items:center;gap:10px}

.pill{
  display:inline-flex;
  align-items:center;
  gap:6px;
  height:26px;
  padding:0 10px;
  border-radius:999px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.03);
  font-size:12px;
  color:var(--txt-2);
  white-space:nowrap;
}

.pill i{
  width:6px;height:6px;border-radius:50%;
  background:var(--txt-3);
  display:block;
}
.pill.is-ready i{background:var(--green);box-shadow:0 0 8px rgba(61,220,151,.8)}
.pill.is-busy i{background:var(--amber);box-shadow:0 0 8px rgba(232,165,90,.8)}

.btn-ghost{
  height:28px;
  padding:0 12px;
  display:inline-flex;
  align-items:center;
  gap:6px;
  border-radius:8px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.03);
  color:var(--txt-2);
  font-size:12.5px;
  text-decoration:none;
  cursor:pointer;
  transition:.18s;
  font-family:inherit;
}
.btn-ghost:hover{background:rgba(255,255,255,.07);color:var(--txt);border-color:var(--line-hi)}

/* ── 主区 ── */
main{
  position:relative;
  z-index:1;
  max-width:1180px;
  margin:0 auto;
  padding:0 22px 76px;
}

.hero{
  text-align:center;
  padding:64px 0 44px;
}

.hero h1{
  font-size:30px;
  font-weight:650;
  letter-spacing:-.4px;
  margin-bottom:14px;
  background:linear-gradient(180deg,#fff,#b9c8e0);
  -webkit-background-clip:text;
  background-clip:text;
  color:transparent;
}

.hero p{
  color:var(--txt-2);
  font-size:13.5px;
  max-width:620px;
  margin:0 auto 26px;
  line-height:1.75;
}

.hero p code{
  font-family:var(--mono);
  font-size:12.5px;
  color:#a9c4ff;
  background:rgba(79,140,255,.10);
  padding:1px 5px;
  border-radius:5px;
}

.search{
  position:relative;
  max-width:520px;
  margin:0 auto;
  display:flex;
  align-items:center;
  gap:10px;
  height:42px;
  padding:0 12px 0 14px;
  border-radius:11px;
  border:1px solid var(--line-hi);
  background:rgba(17,25,38,.9);
  box-shadow:0 10px 34px rgba(0,0,0,.36);
  transition:.2s;
}
.search:focus-within{border-color:rgba(79,140,255,.55);box-shadow:0 0 0 3px rgba(79,140,255,.12),0 10px 34px rgba(0,0,0,.36)}

.search svg{width:15px;height:15px;flex-shrink:0;color:var(--txt-3)}

.search input{
  flex:1;
  min-width:0;
  border:0;
  outline:0;
  background:none;
  color:var(--txt);
  font-size:13.5px;
  font-family:inherit;
}
.search input::placeholder{color:var(--txt-3)}

.search kbd{
  font-family:var(--mono);
  font-size:11px;
  color:var(--txt-3);
  border:1px solid var(--line);
  border-radius:5px;
  padding:1px 5px;
  background:rgba(255,255,255,.03);
}

.hero-meta{
  margin-top:16px;
  font-size:12px;
  color:var(--txt-3);
  display:flex;
  gap:8px;
  justify-content:center;
  flex-wrap:wrap;
}
.hero-meta b{color:var(--txt-2);font-weight:500}

/* ── 分组 ── */
.group{margin-bottom:34px}

.group-head{
  display:flex;
  align-items:baseline;
  gap:10px;
  margin-bottom:13px;
  padding-left:2px;
}

.group-head h2{
  font-size:13.5px;
  font-weight:600;
  color:var(--txt);
  letter-spacing:.2px;
}

.group-head span{
  font-size:11.5px;
  color:var(--txt-3);
  font-family:var(--mono);
}

.group-head .rule{
  flex:1;
  height:1px;
  background:linear-gradient(90deg,var(--line),transparent);
}

/* ── 卡片网格 ── */
.grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(255px,1fr));
  gap:11px;
}

.card{
  position:relative;
  display:flex;
  gap:12px;
  padding:14px 15px;
  border-radius:11px;
  border:1px solid var(--line);
  background:linear-gradient(180deg,rgba(19,28,41,.92),rgba(15,22,33,.92));
  cursor:pointer;
  text-align:left;
  font-family:inherit;
  transition:transform .18s cubic-bezier(.2,.8,.24,1), border-color .18s, background .18s, box-shadow .18s;
  overflow:hidden;
}

.card::after{
  content:"";
  position:absolute;
  inset:0;
  background:radial-gradient(220px 90px at 12% 0%, rgba(79,140,255,.14), transparent 70%);
  opacity:0;
  transition:opacity .22s;
  pointer-events:none;
}

.card:hover{
  transform:translateY(-2px);
  border-color:rgba(79,140,255,.36);
  box-shadow:0 10px 26px rgba(0,0,0,.42), 0 0 0 1px rgba(79,140,255,.10) inset;
}
.card:hover::after{opacity:1}
.card:focus-visible{outline:2px solid rgba(79,140,255,.6);outline-offset:2px}

.card-ico{
  flex-shrink:0;
  width:30px;
  height:30px;
  border-radius:8px;
  display:grid;
  place-items:center;
  background:rgba(79,140,255,.10);
  border:1px solid rgba(79,140,255,.16);
  color:#8fb4ff;
}
.card-ico svg{width:16px;height:16px}

.card-body{min-width:0;flex:1}

.card-title{
  font-size:13.5px;
  font-weight:600;
  color:#e6edf8;
  margin-bottom:3px;
  display:flex;
  align-items:center;
  gap:6px;
}

.card-desc{
  font-size:12px;
  color:var(--txt-3);
  line-height:1.5;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}

.card-tag{
  position:absolute;
  top:11px;
  right:12px;
  font-size:10px;
  color:var(--txt-3);
  border:1px solid var(--line);
  border-radius:999px;
  padding:1px 6px;
  background:rgba(255,255,255,.02);
  letter-spacing:.3px;
}

/* 搜索无结果 */
.empty{
  text-align:center;
  padding:60px 0;
  color:var(--txt-3);
  font-size:13px;
}

/* ── 底部状态栏 ── */
.statusbar{
  position:fixed;
  left:0;right:0;bottom:0;
  z-index:40;
  height:30px;
  display:flex;
  align-items:center;
  gap:14px;
  padding:0 16px;
  font-size:11px;
  color:var(--txt-3);
  background:rgba(9,13,20,.92);
  backdrop-filter:blur(12px);
  -webkit-backdrop-filter:blur(12px);
  border-top:1px solid var(--line);
  font-family:var(--mono);
  white-space:nowrap;
  overflow:hidden;
}

.statusbar .dot{
  width:6px;height:6px;border-radius:50%;
  background:var(--green);
  box-shadow:0 0 7px rgba(61,220,151,.75);
  flex-shrink:0;
}
.statusbar .sep{flex:1}
.statusbar .sb-item{display:flex;align-items:center;gap:6px}

/* ── 工具面板 ── */
.modal{
  position:fixed;
  inset:0;
  z-index:100;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
  background:rgba(4,7,11,.72);
  backdrop-filter:blur(6px);
  -webkit-backdrop-filter:blur(6px);
  opacity:0;
  pointer-events:none;
  transition:opacity .2s;
}
.modal.is-open{opacity:1;pointer-events:auto}

.sheet{
  width:min(960px,100%);
  height:min(720px,88vh);
  display:flex;
  flex-direction:column;
  border-radius:16px;
  border:1px solid var(--line-hi);
  background:linear-gradient(180deg,#0f1723,#0b111a);
  box-shadow:0 30px 80px rgba(0,0,0,.62);
  overflow:hidden;
  transform:translateY(10px) scale(.99);
  transition:transform .24s cubic-bezier(.2,.8,.24,1);
}
.modal.is-open .sheet{transform:none}

.sheet-head{
  display:flex;
  align-items:flex-start;
  gap:12px;
  padding:16px 18px;
  border-bottom:1px solid var(--line);
  flex-shrink:0;
}

.sheet-ico{
  flex-shrink:0;
  width:34px;height:34px;
  border-radius:9px;
  display:grid;place-items:center;
  background:rgba(79,140,255,.12);
  border:1px solid rgba(79,140,255,.2);
  color:#8fb4ff;
}
.sheet-ico svg{width:17px;height:17px}

.sheet-title{flex:1;min-width:0}
.sheet-title h3{font-size:15px;font-weight:600;margin-bottom:2px}
.sheet-title p{font-size:12px;color:var(--txt-3)}

.sheet-close{
  width:28px;height:28px;
  border-radius:7px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.03);
  color:var(--txt-2);
  cursor:pointer;
  display:grid;place-items:center;
  transition:.16s;
  flex-shrink:0;
}
.sheet-close:hover{background:rgba(255,255,255,.08);color:#fff}

.sheet-body{
  flex:1;
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:0;
  min-height:0;
}

.pane{
  display:flex;
  flex-direction:column;
  min-height:0;
  padding:14px 16px;
  gap:9px;
}
.pane + .pane{border-left:1px solid var(--line)}

.pane-label{
  font-size:11px;
  color:var(--txt-3);
  letter-spacing:.4px;
  text-transform:uppercase;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
}

.field{display:flex;flex-direction:column;gap:5px;flex-shrink:0}
.field label{font-size:11.5px;color:var(--txt-3)}

/* 字段区撑满面板，多行文本框吃掉剩余高度 */
#fields{display:flex;flex-direction:column;gap:9px;flex:1;min-height:0}
.field:has(textarea){flex:1 1 auto;min-height:0}
.field:has(textarea) textarea{flex:1 1 auto;min-height:0}

input[type=text],input[type=number],textarea,select{
  width:100%;
  border-radius:8px;
  border:1px solid var(--line);
  background:rgba(6,10,16,.7);
  color:var(--txt);
  font-family:var(--mono);
  font-size:12.5px;
  padding:8px 10px;
  outline:0;
  transition:.16s;
  resize:none;
}
input:focus,textarea:focus,select:focus{
  border-color:rgba(79,140,255,.5);
  box-shadow:0 0 0 3px rgba(79,140,255,.10);
}
textarea{flex:1;min-height:120px;line-height:1.65}
select{font-family:var(--sans);cursor:pointer}

.row{display:flex;gap:8px;align-items:center}

.btn{
  height:31px;
  padding:0 14px;
  border-radius:8px;
  border:1px solid rgba(79,140,255,.4);
  background:linear-gradient(180deg,rgba(79,140,255,.92),rgba(62,116,230,.92));
  color:#fff;
  font-size:12.5px;
  font-weight:500;
  cursor:pointer;
  font-family:inherit;
  transition:.16s;
  white-space:nowrap;
}
.btn:hover{filter:brightness(1.1);box-shadow:0 4px 14px rgba(79,140,255,.28)}
.btn:active{transform:translateY(1px)}
.btn:disabled{opacity:.5;cursor:not-allowed}

.btn-soft{
  height:29px;
  padding:0 11px;
  border-radius:7px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.035);
  color:var(--txt-2);
  font-size:12px;
  cursor:pointer;
  font-family:inherit;
  transition:.16s;
  white-space:nowrap;
}
.btn-soft:hover{background:rgba(255,255,255,.08);color:var(--txt)}
.btn-soft.is-on{background:rgba(79,140,255,.16);border-color:rgba(79,140,255,.45);color:#a9c4ff}

.out{
  flex:1;
  min-height:0;
  overflow:auto;
  border-radius:8px;
  border:1px solid var(--line);
  background:rgba(4,8,13,.72);
  padding:11px 12px;
  font-family:var(--mono);
  font-size:12px;
  line-height:1.7;
  white-space:pre-wrap;
  word-break:break-word;
  color:#c3d2e6;
  tab-size:2;
}
.out.is-err{color:#ffb4b4;border-color:rgba(255,107,107,.28);background:rgba(255,60,60,.05)}
.out.is-ok{color:#c3d2e6}
.out .ln-add{color:#69db99}
.out .ln-del{color:#ff8b8b}
.out .ln-same{color:#7d8ca3}
.out .k{color:#8fb4ff}
.out .s{color:#a8e6a3}
.out .n{color:#ffc98b}
.out .b{color:#d8a6ff}

.meta-line{
  font-size:11px;
  color:var(--txt-3);
  font-family:var(--mono);
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}

.srcbox{
  display:none;
  flex:1;
  min-height:0;
  overflow:auto;
  border-radius:8px;
  border:1px solid var(--line);
  background:rgba(4,8,13,.72);
  padding:11px 12px;
  font-family:var(--mono);
  font-size:11.5px;
  line-height:1.72;
  white-space:pre;
  color:#9fb3cd;
  tab-size:2;
}
.srcbox.is-open{display:block}
body.show-src .out{display:none}
body.show-src .srcbox{display:block}

/* ── REPL ── */
.repl-fab{
  position:fixed;
  right:18px;
  bottom:44px;
  z-index:80;
  width:42px;
  height:42px;
  border-radius:12px;
  border:1px solid rgba(79,140,255,.35);
  background:linear-gradient(150deg,#16233a,#101a2b);
  color:#8fb4ff;
  font-family:var(--mono);
  font-size:17px;
  font-weight:600;
  cursor:pointer;
  display:grid;
  place-items:center;
  box-shadow:0 10px 26px rgba(0,0,0,.5);
  transition:.2s;
}
.repl-fab:hover{transform:translateY(-2px);border-color:rgba(79,140,255,.7);color:#cfe0ff}

.repl{
  position:fixed;
  right:16px;
  bottom:44px;
  z-index:90;
  width:min(480px,calc(100vw - 32px));
  height:min(430px,70vh);
  display:flex;
  flex-direction:column;
  border-radius:14px;
  border:1px solid var(--line-hi);
  background:linear-gradient(180deg,#0e1623,#0a1017);
  box-shadow:0 24px 60px rgba(0,0,0,.6);
  transform:translateY(14px);
  opacity:0;
  pointer-events:none;
  transition:.22s cubic-bezier(.2,.8,.24,1);
  overflow:hidden;
}
.repl.is-open{transform:none;opacity:1;pointer-events:auto}

.repl-head{
  display:flex;
  align-items:center;
  gap:8px;
  padding:10px 13px;
  border-bottom:1px solid var(--line);
  font-size:12px;
  color:var(--txt-2);
  flex-shrink:0;
}
.repl-head b{color:var(--txt);font-weight:600;font-size:12.5px}
.repl-head .sp{flex:1}
.repl-head button{
  background:none;border:0;color:var(--txt-3);cursor:pointer;
  font-size:15px;line-height:1;padding:2px 4px;border-radius:5px;
}
.repl-head button:hover{color:var(--txt);background:rgba(255,255,255,.06)}

.repl-log{
  flex:1;
  overflow:auto;
  padding:10px 13px;
  font-family:var(--mono);
  font-size:12px;
  line-height:1.7;
  white-space:pre-wrap;
  word-break:break-word;
}
.repl-log .in{color:#8fb4ff}
.repl-log .out{color:#a8e6a3}
.repl-log .err{color:#ff9b9b}
.repl-log .note{color:var(--txt-3)}

.repl-input{
  display:flex;
  align-items:center;
  gap:8px;
  padding:9px 12px;
  border-top:1px solid var(--line);
  flex-shrink:0;
}
.repl-input span{color:var(--accent);font-family:var(--mono);font-size:13px}
.repl-input input{
  flex:1;
  border:0;outline:0;background:none;
  color:var(--txt);
  font-family:var(--mono);
  font-size:12.5px;
}
.repl-input input::placeholder{color:var(--txt-3)}

/* 滚动条 */
::-webkit-scrollbar{width:9px;height:9px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:rgba(255,255,255,.10);border-radius:6px;border:2px solid transparent;background-clip:content-box}
::-webkit-scrollbar-thumb:hover{background:rgba(255,255,255,.20);background-clip:content-box}

/* ── 响应式 ── */
@media (max-width:820px){
  .sheet-body{grid-template-columns:1fr;grid-template-rows:auto auto}
  .pane + .pane{border-left:0;border-top:1px solid var(--line)}
  .sheet{height:92vh}
  .hero{padding:42px 0 32px}
  .hero h1{font-size:24px}
  .grid{grid-template-columns:1fr}
  .topbar{padding:0 14px;gap:10px}
  .brand-name{display:none}
  main{padding:0 14px 70px}
  .statusbar{font-size:10px;gap:10px}
  .statusbar .hide-sm{display:none}
}

@media (prefers-reduced-motion:reduce){
  *{transition:none !important;animation:none !important}
}

/* ── 二维码 / 文件选择 ── */
.qr-wrap{display:flex;flex-direction:column;align-items:center;gap:12px;padding:6px 0 2px}
.qr-wrap svg{border-radius:10px;box-shadow:0 0 0 1px rgba(255,255,255,.10),0 8px 26px rgba(0,0,0,.45)}
.qr-meta{font-size:11px;color:var(--txt-3);letter-spacing:.2px}
input[type=file]{
  width:100%;padding:9px 11px;border-radius:9px;cursor:pointer;
  background:var(--panel-2,rgba(255,255,255,.04));
  border:1px dashed rgba(255,255,255,.18);
  color:var(--txt-2);font-size:12px;
}
input[type=file]::file-selector-button{
  margin-right:10px;padding:6px 12px;border-radius:7px;cursor:pointer;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.07);color:var(--txt-1);font-size:12px;
}
input[type=file]:hover{border-color:rgba(79,140,255,.55)}
