* { box-sizing: border-box; }

:root {
  /* 与 tool.lu/tool 一致的色彩体系 */
  --green: #009a61;
  --green-dark: #008151;
  --green-light: #e9f7f0;
  --blue: #3399ff;

  --text: #444444;
  --text-secondary: #555555;
  --text-muted: #888888;
  --text-faint: #999999;

  --border: #cccccc;
  --border-soft: #e6e6e6;
  --surface: #ffffff;
  --surface-soft: #f5f5f5;
  --danger: #d9534f;
  --warning: #f5a623;

  --radius: 8px;
  --radius-sm: 4px;
}

html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-size: 12.8px;
  line-height: 1.65;
  color: var(--text);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.4; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }
::selection { background: #d3efe1; color: #123b2a; }
:focus-visible { outline: 2px solid rgba(0, 154, 97, .35); outline-offset: 2px; }
.container { width: min(1190px, calc(100% - 32px)); margin: 0 auto; }

/* 顶部深色条：#363636 / 29px / 14px 文字 */
.topbar { height: 29px; background: #363636; color: #cccccc; font-size: 14px; }
.topbar-inner { display: flex; align-items: center; height: 29px; gap: 0; }
.topbar-brand { color: #cccccc; font-weight: 400; padding: 0 12px; }
.topbar-spacer { flex: 1; }
.topbar a { color: #cccccc; padding: 0 12px; line-height: 29px; transition: color .15s; }
.topbar a:hover { color: #ffffff; }

/* 头部：28px 品牌字 + 40px 搜索框 */
.site-header { background: var(--surface); }
.header-inner { display: flex; align-items: center; gap: 32px; min-height: 95px; }
.logo { display: flex; align-items: center; gap: 9px; color: var(--green); font-size: 28px; font-weight: 400; white-space: nowrap; }
.logo-icon { font-size: 28px; line-height: 1; }
.search-wrap { flex: 1; max-width: 472px; }
.search-box {
  display: flex; align-items: center; height: 40px;
  background: rgba(0, 0, 0, .05); border: 1px solid transparent; border-radius: var(--radius-sm);
  padding-left: 16px; transition: border-color .15s, box-shadow .15s;
}
.search-box:focus-within { border-color: #9cd9bb; background: #fff; box-shadow: 0 0 0 3px rgba(0, 154, 97, .08); }
.search-icon { font-size: 13px; color: var(--text-faint); margin-right: 8px; }
.search-box input { flex: 1; min-width: 60px; border: 0; outline: 0; background: transparent; color: #0c0d0f; font-size: 14px; }
.search-box input::placeholder { color: #999999; }
.quick-links { display: flex; gap: 12px; padding: 0 14px; white-space: nowrap; }
.quick-links a { color: var(--green); font-size: 13px; }
.quick-links a:hover { text-decoration: underline; }
.search-box button {
  height: 100%; padding: 0 16px; border: 0; border-left: 1px solid rgba(0, 0, 0, .06);
  background: transparent; color: var(--green); font-size: 14px; font-weight: 400;
}
.search-box button:hover { background: var(--green-light); }
.mobile-search-toggle { display: none; background: none; border: 0; font-size: 20px; margin-left: auto; }

/* 主导航：浅灰底，选中项白底绿字 + 蓝色下划线 */
.main-nav { background: var(--surface-soft); border-top: 1px solid #efefef; border-bottom: 1px solid var(--border-soft); }
.nav-inner { display: flex; align-items: stretch; gap: 0; min-height: 42px; padding: 5px 10px 0; }
.nav-inner > a {
  padding: 0 14px; color: var(--text); font-size: 15px; line-height: 32px;
  border-bottom: 2px solid transparent; border-radius: 3px 3px 0 0; white-space: nowrap;
  transition: color .15s;
}
.nav-inner > a:hover { color: var(--green); }
.nav-inner > a.active { background: var(--surface); color: var(--green); border-bottom-color: var(--blue); }

/* 列表页：横向分类栏 + 四列卡片 */
.app-root { min-height: 60vh; }
.list-page { padding: 18px 0 50px; }
.cat-tabs {
  display: flex; align-items: center; gap: 12px; overflow-x: auto;
  margin-bottom: 10px; scrollbar-width: none;
}
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
  position: relative; flex: 0 0 auto; height: 30px; padding: 0 6px;
  border: 0; background: transparent; color: var(--text); font-size: 15px; line-height: 30px; white-space: nowrap;
  transition: color .15s;
}
.cat-tab::after {
  content: ''; position: absolute; left: 50%; bottom: 0; width: 28px; height: 4px;
  background: var(--green); border-radius: 2px; transform: translateX(-50%); opacity: 0;
}
.cat-tab:hover { color: var(--green); }
.cat-tab.active { color: var(--green); }
.cat-tab.active::after { opacity: 1; }

.tool-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.tool-card {
  display: flex; flex-direction: column; min-height: 146px;
  padding: 10px 15px 10px 8px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.tool-card:hover { border-color: var(--green); box-shadow: 0 0 8px rgba(0, 0, 0, .08); }
.card-top { display: flex; align-items: flex-start; gap: 10px; }
.tool-icon {
  width: 48px; height: 48px; flex: 0 0 48px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; line-height: 1; background: transparent; border: 0; border-radius: var(--radius-sm);
}
.card-title-wrap { min-width: 0; flex: 1; }
.card-title-line { display: flex; align-items: baseline; gap: 4px; min-width: 0; }
.card-title { font-size: 16px; font-weight: 700; color: #333333; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-title:hover { color: var(--green); }
.card-cat { color: var(--text-faint); font-size: 12.8px; flex: 0 0 auto; margin-left: auto; }
.fav-btn { border: 0; background: transparent; color: var(--text-faint); font-size: 12.8px; line-height: 1.65; padding: 4px 0 0; transition: color .15s; }
.fav-btn:hover, .fav-btn.faved { color: var(--warning); }
.card-desc {
  color: var(--text); font-size: 12.8px; line-height: 1.65;
  padding: 10px 0; margin: 8px 0 0; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--border-soft); padding-top: 6px; }
.card-url { color: var(--text-faint); font-size: 12.8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 74%; }
.card-enter { color: #333333; font-size: 12.8px; font-weight: 400; padding: 3px 12px; flex: 0 0 auto; }
.card-enter:hover { color: var(--green); }
.empty-state { padding: 90px 20px; text-align: center; color: var(--text-muted); font-size: 13px; }
.empty-state .empty-icon { font-size: 44px; display: block; margin-bottom: 12px; }

/* 工具详情页：与列表页共用边框、圆角与字号体系 */
.tool-page { padding: 18px 0 50px; }
.crumb { color: var(--text-muted); font-size: 12.8px; margin-bottom: 16px; }
.crumb a:hover { color: var(--green); }
.crumb span { margin: 0 6px; color: #cccccc; }
.tool-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.tool-head .tool-icon { width: 56px; height: 56px; flex-basis: 56px; font-size: 30px; }
.tool-head h1 { margin: 0; font-size: 24px; font-weight: 600; color: #333333; }
.tool-head p { margin: 3px 0 0; color: var(--text-muted); font-size: 13px; }
.tool-head .fav-btn { margin-left: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 12px; font-size: 12.8px; color: var(--text-secondary); }
.tool-head .fav-btn.faved { color: var(--warning); border-color: #f2d9a6; background: #fffaf0; }
.panel { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.tool-panel { padding: 20px; font-size: 13px; }
.panel-title { font-size: 15px; font-weight: 700; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; color: #333333; }
.panel-title .dot { width: 7px; height: 7px; background: var(--green); border-radius: 50%; display: inline-block; }
.options { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-bottom: 16px; }
.opt { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); }
.opt input[type="text"], .opt input[type="number"], .opt select {
  border: 1px solid #dddddd; border-radius: var(--radius-sm); padding: 7px 9px;
  outline: 0; background: var(--surface); color: var(--text); transition: border-color .15s, box-shadow .15s;
}
.opt input[type="text"]:focus, .opt input[type="number"]:focus, .opt select:focus { border-color: #9cd9bb; box-shadow: 0 0 0 3px rgba(0, 154, 97, .08); }
.opt input[type="checkbox"] { accent-color: var(--green); }
.workspace { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
textarea.field {
  width: 100%; min-height: 300px; resize: vertical;
  border: 1px solid #dddddd; border-radius: var(--radius-sm); padding: 12px;
  outline: 0; line-height: 1.7; font-family: Consolas, "Courier New", monospace; font-size: 13px;
  transition: border-color .15s, box-shadow .15s;
}
textarea.field:focus { border-color: #9cd9bb; box-shadow: 0 0 0 3px rgba(0, 154, 97, .08); }
textarea.field[readonly] { background: #fafafa; }
.field-hint { margin-top: 6px; color: var(--text-faint); font-size: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 4px; }
.btn {
  border: 1px solid var(--green); background: var(--green); color: #fff;
  padding: 8px 18px; border-radius: var(--radius-sm); font-weight: 400; transition: filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.06); }
.btn.ghost { background: var(--surface); color: var(--green); }
.btn.ghost:hover { background: var(--green-light); }
.btn.plain { background: var(--surface); color: var(--text-secondary); border-color: var(--border); }
.btn.plain:hover { background: var(--surface-soft); }
.tool-note { margin-top: 16px; padding: 12px 14px; background: var(--surface-soft); border-radius: var(--radius-sm); color: var(--text-muted); font-size: 12px; }
.result-card { margin-top: 18px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.result-card h3 { margin: 0 0 10px; font-size: 15px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.stat { background: var(--surface-soft); border-radius: var(--radius-sm); padding: 12px 14px; }
.stat .k { color: var(--text-muted); font-size: 12px; }
.stat .v { color: var(--green); font-size: 20px; font-weight: 600; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.badge.ok { background: var(--green-light); color: var(--green-dark); }
.badge.bad { background: #fff0f0; color: var(--danger); }
.strength-bar { height: 8px; background: #eeeeee; border-radius: 4px; overflow: hidden; margin: 10px 0; }
.strength-bar i { display: block; height: 100%; width: 0; transition: width .25s, background .25s; }
.keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; max-width: 320px; }
.keys button { padding: 10px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-sm); color: var(--text-secondary); }
.keys button:hover { background: var(--surface-soft); border-color: var(--green); }
.keys button.op { color: var(--green); font-weight: 600; }
.calc-display { width: 100%; border: 1px solid #dddddd; border-radius: var(--radius-sm); padding: 12px; font-size: 20px; font-family: Consolas, monospace; text-align: right; outline: 0; }
.calc-result { margin-top: 10px; text-align: right; font-size: 26px; color: var(--green); font-weight: 600; word-break: break-all; }
.color-preview { width: 100%; height: 90px; border-radius: var(--radius-sm); border: 1px solid var(--border); margin-bottom: 12px; }
.file-drop { border: 2px dashed #d9e5df; border-radius: var(--radius-sm); padding: 28px; text-align: center; color: var(--text-muted); cursor: pointer; background: #fbfefc; }
.file-drop:hover { border-color: var(--green); color: var(--green); }
.file-drop img { max-width: 100%; max-height: 220px; margin-top: 12px; border-radius: var(--radius-sm); }
.inline-result { margin-top: 12px; padding: 12px; background: var(--surface-soft); border-radius: var(--radius-sm); font-family: Consolas, monospace; font-size: 13px; line-height: 1.7; word-break: break-all; white-space: pre-wrap; }
.error-text { color: var(--danger); font-size: 13px; margin-top: 8px; }

/* 页脚与提示 */
.site-footer { border-top: 1px solid var(--border-soft); background: var(--surface-soft); color: var(--text-muted); padding: 22px 0; text-align: center; font-size: 12px; }
.site-footer p { margin: 2px 0; }
.footer-note { color: var(--text-faint); }
.toast {
  position: fixed; left: 50%; bottom: 36px; transform: translate(-50%, 20px);
  background: rgba(51, 51, 51, .94); color: #fff; padding: 10px 18px; border-radius: var(--radius-sm);
  font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 99;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 响应式：列数随视口递减，间距与参考站节奏一致 */
@media (max-width: 1200px) {
  .tool-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .list-page { padding-top: 14px; }
  .header-inner { flex-wrap: wrap; gap: 12px; padding: 12px 0; min-height: 70px; }
  .mobile-search-toggle { display: block; }
  .search-wrap { display: none; }
  .search-wrap.open { display: block; flex-basis: 100%; order: 3; max-width: none; }
  .workspace { grid-template-columns: 1fr; }
  textarea.field { min-height: 220px; }
}
@media (max-width: 600px) {
  .container { width: calc(100% - 24px); }
  .topbar a[data-nav="register"] { display: none; }
  .logo { font-size: 24px; }
  .nav-inner { overflow-x: auto; scrollbar-width: none; }
  .nav-inner::-webkit-scrollbar { display: none; }
  .tool-grid { grid-template-columns: 1fr; }
  .tool-card { min-height: 0; }
  .quick-links { gap: 8px; padding: 0 8px; }
  .tool-head { flex-wrap: wrap; }
  .tool-head .fav-btn { margin-left: 0; }
  .keys { grid-template-columns: repeat(4, 1fr); max-width: none; }
}
