/* 小草工具箱 —— 整站样式 */
:root {
    --accent: #055076;
    --accent-soft: rgba(5, 80, 118, 0.08);
    --bg: #f5f7fa;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-sub: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== 页头 ===== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}
.site-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 19px;
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
}
.brand i { font-size: 22px; }
.tool-title {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.tool-title i { color: var(--accent); }
.back-home {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s;
}
.back-home:hover { background: rgba(5, 80, 118, 0.16); }

/* ===== 主页 ===== */
.site-main { flex: 1; max-width: 1200px; width: 100%; margin: 0 auto; padding: 24px 20px 40px; }

/* ===== 工具页统一内容宽度：视口 90%（仅宽屏，移动端保留各页自适应） ===== */
@media (min-width: 769px) {
  /* 部分工具把宽高限制写在 body 上，会连带压住外壳，这里一并解除 */
  body.tool-body { max-width: none; }
  .site-main.tool-main { max-width: 100%; padding-left: 0; padding-right: 0; }
  .site-main.tool-main > * {
    width: 90%;
    max-width: none;
    margin-left: auto;
    margin-right: auto;
  }
}

.hero {
    text-align: center;
    padding: 30px 0 24px;
}
.hero h1 {
    font-size: 30px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 8px;
}
.hero p {
    color: var(--text-sub);
    font-size: 15px;
}

.search-bar {
    max-width: 560px;
    margin: 18px auto 22px;
    position: relative;
}
.search-bar input {
    width: 100%;
    padding: 13px 18px 13px 44px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
    background: #fff;
}
.search-bar input:focus { border-color: var(--accent); }
.search-bar i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-sub);
}

/* 分类筛选 */
.cat-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 26px;
}
.cat-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 14px;
    color: var(--text-sub);
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}
.cat-chip i { font-size: 13px; }
.cat-chip:hover { border-color: var(--accent); color: var(--accent); }
.cat-chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* 工具网格 */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}
.tool-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px 16px 14px;
    text-decoration: none;
    color: var(--text);
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    overflow: hidden;
}
.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: var(--accent);
}
.tool-card:hover .tool-card-go { background: var(--accent); color: #fff; border-color: var(--accent); }
/* 头部：图标 + 标题同行 */
.tool-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.tool-card-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    color: #fff;
    flex-shrink: 0;
}
.tool-card-name {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    min-width: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.tool-card-desc {
    font-size: 12.5px;
    color: var(--text-sub);
    line-height: 1.5;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.9em;
}
/* 底部：分类标签 + 点击查看 */
.tool-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 2px;
}
.tool-card-cat {
    font-size: 11.5px;
    color: var(--text-sub);
    background: #f3f5f9;
    padding: 3px 8px;
    border-radius: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tool-card-cat i { font-size: 10px; margin-right: 4px; }
.tool-card-go {
    font-size: 12px;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid transparent;
    padding: 4px 10px;
    border-radius: 6px;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s;
}
.tool-card-go i { font-size: 10px; margin-left: 4px; }
.tool-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
}
.empty-tip {
    text-align: center;
    color: var(--text-sub);
    padding: 50px 0;
    font-size: 15px;
}

.stats {
    text-align: center;
    color: var(--text-sub);
    font-size: 13px;
    margin-bottom: 20px;
}

/* ===== 工具页容器 ===== */
.tool-page {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px;
    margin-top: 18px;
    box-shadow: var(--shadow);
}
.tool-page h1, .tool-page h2, .tool-page h3 { color: var(--accent); }

/* ===== 页脚 ===== */
.site-footer {
    text-align: center;
    padding: 26px 20px;
    color: var(--text-sub);
    font-size: 13px;
    border-top: 1px solid var(--border);
    background: #fff;
}
.site-footer-sub { font-size: 12px; margin-top: 4px; opacity: 0.8; }

/* iframe 内嵌时隐藏工具页自带页头/页脚（与主页外壳重复） */
.in-iframe .site-header,
.in-iframe .site-footer { display: none; }

/* ===== 工具页外壳：页头/页脚强制通栏 =====
   部分工具页内联样式把 body 设为 flex 居中、自带水平 padding，导致页头页脚作为 flex 子项收缩；
   这里强制通栏（!important 压过页面内联样式） */
body.tool-body { padding-left: 0 !important; padding-right: 0 !important; }
body.tool-body > .site-header,
body.tool-body > .site-footer {
    width: 100% !important;
    max-width: none !important;
    align-self: stretch !important;
}

@media (max-width: 768px) {
    .hero h1 { font-size: 24px; }
    .tool-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
    .tool-card { padding: 16px; }
}
