/* 毛桃工具箱 · 视觉与主站 maotao.tech 对齐 */
:root {
  --bg: #05060a;
  --bg-2: #0a0e18;
  --cyan: #22d3ee;
  --violet: #a855f7;
  --peach: #ff8a5c;
  --green: #38f08a;
  --red: #ff5c7a;
  --text: #e8f1ff;
  --muted: #8ba1c2;
  --dim: #5d7291;
  --card: rgba(255, 255, 255, 0.035);
  --border: rgba(255, 255, 255, 0.09);
  --mono: "Cascadia Code", Consolas, "SFMono-Regular", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

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

/* 背景网格 + 光晕 */
.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 520px at 78% -8%, rgba(34, 211, 238, 0.10), transparent 62%),
    radial-gradient(760px 460px at 8% 106%, rgba(168, 85, 247, 0.10), transparent 62%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}

.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
  background-size: 54px 54px;
  -webkit-mask-image: radial-gradient(circle at 50% 26%, #000 0%, transparent 78%);
          mask-image: radial-gradient(circle at 50% 26%, #000 0%, transparent 78%);
}

/* 顶栏 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 22px;
  background: rgba(5, 6, 10, 0.74);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}

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

.brand .mark {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 10px;
  font-weight: 800; font-size: 15px; letter-spacing: -0.5px;
  color: #05060a;
  background: linear-gradient(130deg, var(--cyan), #7dd3fc 42%, var(--violet));
  box-shadow: 0 6px 20px rgba(34, 211, 238, 0.28);
}

.brand b { font-size: 15.5px; letter-spacing: 0.2px; }
.brand span { font-size: 11.5px; color: var(--dim); display: block; margin-top: 1px; }

.topbar .spacer { flex: 1; }

.top-link {
  font-size: 12.5px; color: var(--muted); text-decoration: none;
  padding: 7px 13px; border: 1px solid var(--border); border-radius: 9px;
  background: rgba(255, 255, 255, 0.03); transition: 0.2s;
}
.top-link:hover { color: var(--cyan); border-color: rgba(34, 211, 238, 0.45); background: rgba(34, 211, 238, 0.07); }

/* 主体骨架 */
.shell {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 22px 60px;
  display: grid;
  grid-template-columns: 258px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

/* 侧栏 */
.side {
  position: sticky;
  top: 82px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  backdrop-filter: blur(10px);
  max-height: calc(100vh - 106px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.search {
  width: 100%;
  padding: 10px 13px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: rgba(0, 0, 0, 0.34);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: 0.2s;
}
.search::placeholder { color: var(--dim); }
.search:focus { border-color: rgba(34, 211, 238, 0.5); box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.09); }

.nav { overflow-y: auto; margin: -3px -6px -3px -3px; padding: 3px 6px 3px 3px; }
.nav::-webkit-scrollbar { width: 5px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.13); border-radius: 3px; }

.nav-group { margin-bottom: 12px; }
.nav-group > h4 {
  margin: 0 0 6px 4px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 1.4px;
  color: var(--dim); text-transform: uppercase;
}

.nav-btn {
  display: flex; align-items: center; gap: 9px;
  width: 100%;
  padding: 8px 10px;
  margin-bottom: 2px;
  font-size: 13px;
  font-family: inherit;
  text-align: left;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  transition: 0.16s;
}
.nav-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.045); }
.nav-btn.on {
  color: var(--text);
  background: linear-gradient(100deg, rgba(34, 211, 238, 0.16), rgba(168, 85, 247, 0.11));
  border-color: rgba(34, 211, 238, 0.34);
}
.nav-btn .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: 0.5; flex: none; }
.nav-btn.on .dot { opacity: 1; box-shadow: 0 0 9px var(--cyan); background: var(--cyan); }

.nav .empty { padding: 16px 6px; font-size: 12.5px; color: var(--dim); }

/* 工作区 */
.work { min-width: 0; }

.tool-head { margin-bottom: 16px; }
.tool-head h2 { margin: 0 0 6px; font-size: 21px; letter-spacing: -0.2px; }
.tool-head p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.65; }
.tool-head .cat {
  display: inline-block; margin-bottom: 9px;
  font-size: 10.5px; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--cyan); padding: 3px 9px; border-radius: 999px;
  border: 1px solid rgba(34, 211, 238, 0.3); background: rgba(34, 211, 238, 0.07);
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  backdrop-filter: blur(10px);
}

/* 通用控件 */
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row + .row { margin-top: 12px; }
.row.end { justify-content: flex-end; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.label { font-size: 12px; color: var(--muted); margin-bottom: 7px; display: block; }
.label .tag { color: var(--dim); font-size: 11px; margin-left: 6px; }

textarea, input[type="text"], input[type="number"], select {
  width: 100%;
  padding: 11px 13px;
  font-size: 13px;
  font-family: var(--mono);
  color: var(--text);
  background: rgba(0, 0, 0, 0.34);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: 0.2s;
  resize: vertical;
}
textarea:focus, input:focus, select:focus {
  border-color: rgba(34, 211, 238, 0.5);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.09);
}
textarea::placeholder, input::placeholder { color: var(--dim); }
select { cursor: pointer; font-family: inherit; }

.btn {
  padding: 9px 17px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  color: #05060a;
  background: linear-gradient(120deg, var(--cyan), #7dd3fc 44%, var(--violet));
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  transition: 0.18s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1.5px); box-shadow: 0 8px 22px rgba(34, 211, 238, 0.22); }
.btn:active { transform: translateY(0); }

.btn.ghost {
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--border);
}
.btn.ghost:hover { border-color: rgba(34, 211, 238, 0.45); background: rgba(34, 211, 238, 0.07); box-shadow: none; }
.btn.sm { padding: 6px 12px; font-size: 12px; }

.out {
  font-family: var(--mono);
  font-size: 12.6px;
  line-height: 1.7;
  color: #cfe6ff;
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 340px;
  overflow: auto;
  margin: 0;
}
.out::-webkit-scrollbar, textarea::-webkit-scrollbar { width: 8px; height: 8px; }
.out::-webkit-scrollbar-thumb, textarea::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 4px; }

.hint { font-size: 12px; color: var(--dim); line-height: 1.6; }
.hint.ok { color: var(--green); }
.hint.err { color: var(--red); }

.pill {
  display: inline-block; padding: 3px 9px; margin: 0 6px 6px 0;
  font-size: 11.5px; color: var(--cyan);
  border: 1px solid rgba(34, 211, 238, 0.3); border-radius: 999px;
  background: rgba(34, 211, 238, 0.06);
}

.seg { display: inline-flex; padding: 3px; gap: 3px; background: rgba(0, 0, 0, 0.34); border: 1px solid var(--border); border-radius: 10px; }
.seg button {
  padding: 6px 13px; font-size: 12.5px; font-family: inherit;
  color: var(--muted); background: transparent; border: 0; border-radius: 7px; cursor: pointer; transition: 0.16s;
}
.seg button:hover { color: var(--text); }
.seg button.on { color: #05060a; background: linear-gradient(120deg, var(--cyan), #7dd3fc); font-weight: 600; }

.stat-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.stat {
  flex: 1; min-width: 96px; padding: 11px 13px;
  background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border); border-radius: 11px;
}
.stat b { display: block; font-size: 18px; font-family: var(--mono); color: var(--cyan); }
.stat span { font-size: 11.5px; color: var(--dim); }

/* diff */
.diff { font-family: var(--mono); font-size: 12.4px; line-height: 1.72; border: 1px solid var(--border); border-radius: 10px; overflow: auto; max-height: 420px; background: rgba(0,0,0,0.42); }
.diff div { padding: 1px 12px; white-space: pre-wrap; word-break: break-all; }
.diff .same { color: var(--dim); }
.diff .add { color: #05130b; background: rgba(56, 240, 138, 0.72); }
.diff .del { color: #1a0509; background: rgba(255, 92, 122, 0.68); }

/* 正则高亮 */
.mark { font-family: var(--mono); font-size: 12.6px; line-height: 1.9; white-space: pre-wrap; word-break: break-all; padding: 13px; background: rgba(0,0,0,0.42); border: 1px solid var(--border); border-radius: 10px; max-height: 300px; overflow: auto; }
.mark em { font-style: normal; color: #05060a; background: var(--cyan); border-radius: 3px; padding: 0 2px; }

/* 颜色 */
.swatch { width: 100%; height: 96px; border-radius: 12px; border: 1px solid var(--border); }
.color-input { width: 100%; height: 44px; padding: 3px; background: rgba(0,0,0,0.34); border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }

/* 图片 */
.drop {
  border: 1.5px dashed var(--border); border-radius: 12px; padding: 30px 18px; text-align: center;
  color: var(--muted); font-size: 13px; cursor: pointer; transition: 0.2s; background: rgba(0, 0, 0, 0.2);
}
.drop:hover, .drop.over { border-color: rgba(34, 211, 238, 0.55); background: rgba(34, 211, 238, 0.06); color: var(--text); }
.drop b { color: var(--cyan); }
.prev { max-width: 100%; max-height: 260px; border-radius: 11px; border: 1px solid var(--border); margin-top: 12px; }

/* 二维码 */
#qrbox { display: inline-block; padding: 14px; background: #fff; border-radius: 12px; line-height: 0; }
#qrbox img, #qrbox svg { display: block; }

/* 移动端 */
@media (max-width: 880px) {
  .shell { grid-template-columns: 1fr; gap: 16px; padding: 16px 14px 48px; }
  .side {
    position: static; max-height: none;
    flex-direction: column; gap: 10px;
  }
  .nav { display: flex; flex-wrap: wrap; gap: 4px; overflow: visible; margin: 0; padding: 0; }
  .nav-group { display: contents; }
  .nav-group > h4 { width: 100%; margin: 6px 0 2px 4px; }
  .nav-btn { width: auto; }
  .grid2 { grid-template-columns: 1fr; }
  .topbar { padding: 11px 14px; }
  .brand span { display: none; }
}
