/* ===== 全局 ===== */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Helvetica Neue", "Segoe UI", "Hiragino Sans GB", "Microsoft Yahei", sans-serif;
  color: #1f2329;
  background: #f7f8fa;
}
a { color: #2f6fed; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== 全屏布局骨架 ===== */
.layout { display: flex; height: 100vh; overflow: hidden; }

/* 左侧导航侧栏 */
.sidebar {
  width: 234px;
  flex: 0 0 234px;
  background: #fff;
  border-right: 1px solid #e4e7eb;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.sidebar .brand {
  padding: 16px 18px;
  font-weight: 700;
  font-size: 18px;
  color: #1f2329;
  border-bottom: 1px solid #e4e7eb;
  white-space: nowrap;
}
.sidebar .brand span { color: #2f6fed; }
.sidebar .cat {
  padding: 14px 18px 6px;
  font-size: 11px;
  font-weight: 700;
  color: #98a2ad;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.sidebar a.tool-link {
  display: block;
  padding: 8px 18px;
  font-size: 14px;
  color: #3a4250;
}
.sidebar a.tool-link:hover { background: #f2f5fb; color: #2f6fed; text-decoration: none; }
.sidebar a.tool-link.active { background: #eef3fe; color: #2f6fed; font-weight: 600; }

/* 右侧主区 */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tool-head {
  padding: 13px 22px;
  border-bottom: 1px solid #e4e7eb;
  background: #fff;
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}
.tool-head h1 { margin: 0; font-size: 19px; }
.tool-head p { margin: 0; color: #6b7280; font-size: 13px; }
.tool-jump { display: none; margin-left: auto; }

/* 工作区 */
.work { flex: 1; min-height: 0; display: flex; }
.work.util { flex-direction: column; overflow: auto; padding: 22px; }
.util-panel { max-width: 1080px; width: 100%; margin: 0 auto; }

/* 双栏（转换类） */
.panes { flex: 1; display: flex; min-height: 0; }
.pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #e4e7eb;
}
.pane:last-child { border-right: 0; }
.pane-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid #e4e7eb;
  background: #fafbfc;
}
.pane-title { font-size: 13px; color: #4f5862; font-weight: 600; }
.dir-tabs { display: flex; gap: 4px; }
.dir-tabs button, .mini-btn {
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid #d9dde3;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  color: #4f5862;
}
.dir-tabs button.active { background: #2f6fed; border-color: #2f6fed; color: #fff; }
.mini-btn:hover { border-color: #2f6fed; color: #2f6fed; }
.pane textarea, .pane pre {
  flex: 1;
  width: 100%;
  border: 0;
  margin: 0;
  padding: 14px;
  font-size: 13px;
  line-height: 1.65;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  background: #fff;
  resize: none;
  overflow: auto;
  white-space: pre;
  color: #1f2329;
}
.pane textarea:focus { outline: none; }
.pane textarea.err, .pane pre.err, #ts-output.err, #re-output.err, #color-output.err {
  color: #d4380d;
  background: #fff2f0;
}

/* 工具类面板控件 */
.field { margin-bottom: 16px; }
.field > label { display: block; font-size: 13px; color: #4f5862; font-weight: 600; margin-bottom: 6px; }
.field textarea, .field input[type="text"] {
  width: 100%;
  border: 1px solid #d9dde3;
  border-radius: 8px;
  padding: 11px 12px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: #1f2329;
}
.field textarea { min-height: 150px; resize: vertical; font-family: "SFMono-Regular", Consolas, Menlo, monospace; line-height: 1.6; }
.field textarea:focus, .field input:focus { outline: none; border-color: #2f6fed; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.btn {
  font-size: 14px;
  padding: 9px 18px;
  border: 0;
  border-radius: 8px;
  background: #2f6fed;
  color: #fff;
  cursor: pointer;
}
.btn:hover { background: #245ad1; }
.note { color: #6b7280; font-size: 13px; }
.mono { font-family: "SFMono-Regular", Consolas, Menlo, monospace; }
#ts-output, #uuid-output, #re-output, #wc-output, #color-output {
  width: 100%;
  border: 1px solid #d9dde3;
  border-radius: 8px;
  padding: 12px;
  font-size: 13px;
  line-height: 1.6;
  font-family: "SFMono-Regular", Consolas, Menlo, monospace;
  background: #fff;
  min-height: 90px;
  resize: vertical;
}
#ts-now, #now { color: #2f6fed; font-size: 13px; word-break: break-all; }

/* ===== 底部广告栏（可关闭） ===== */
.ad {
  position: relative;
  flex: 0 0 50px;
  height: 50px;
  border-top: 1px solid #e4e7eb;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
#ad-close {
  position: absolute;
  top: 3px;
  right: 6px;
  width: 18px;
  height: 18px;
  line-height: 16px;
  text-align: center;
  font-size: 13px;
  color: #98a2ad;
  background: #f2f3f5;
  border: 1px solid #e4e7eb;
  border-radius: 3px;
  cursor: pointer;
  padding: 0;
  z-index: 6;
}
#ad-close:hover { color: #4f5862; background: #e9ebee; }
.ad-label {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  letter-spacing: .5px;
  color: #b0b6be;
  pointer-events: none;
  z-index: 5;
}
body.ad-hidden .ad { display: none; }

/* ===== 首页 ===== */
.home-main { flex: 1; overflow: auto; padding: 30px 26px 40px; }
.home-main h1 { font-size: 26px; margin: 0 0 6px; }
.home-main .sub { color: #6b7280; margin: 0 0 26px; font-size: 15px; max-width: 800px; }
.home-cat { margin-bottom: 26px; }
.home-cat > h2 { font-size: 15px; color: #4f5862; margin: 0 0 12px; }
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}
.home-card {
  background: #fff;
  border: 1px solid #e4e7eb;
  border-radius: 10px;
  padding: 16px;
  transition: box-shadow .15s, border-color .15s;
}
.home-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); border-color: #c9d3e0; text-decoration: none; }
.home-card .t { font-weight: 600; color: #1f2329; font-size: 15px; }
.home-card .d { color: #6b7280; font-size: 13px; margin-top: 6px; line-height: 1.5; }

/* ===== 响应式 ===== */
@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .sidebar { display: none; }
  .tool-jump { display: inline-block; }
  .panes { flex-direction: column; }
  .pane { border-right: 0; border-bottom: 1px solid #e4e7eb; }
  .pane:last-child { border-bottom: 0; }
  .pane textarea, .pane pre { min-height: 32vh; }
}
