/* ============================================================
   小工具模块公共样式（列表页 + 工具页共用）
   约束：零外部资源（无 CDN/字体/图标库），系统字体栈
   ============================================================ */
:root {
    --c-primary: #4CAF50;
    --c-primary-dark: #43A047;
    --c-primary-light: #E8F5E9;
    --c-text: #2B2F33;
    --c-text-sub: #6B7280;
    --c-border: #E2E6EA;
    --c-bg: #F5F6F8;
    --c-card: #FFFFFF;
    --c-danger: #E53935;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(20, 24, 28, .08), 0 4px 14px rgba(20, 24, 28, .05);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font);
    background: var(--c-bg);
    color: var(--c-text);
    font-size: 15px;
    line-height: 1.6;
}
a { color: var(--c-primary); text-decoration: none; }

/* ---------- 页头 / 页脚（与站点其他页面风格一致） ---------- */
.tp-header {
    background: #2B2F33;
    color: #fff;
    padding: 1rem 1.25rem;
}
.tp-header .tp-head-row {
    max-width: 1180px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}
.tp-header h1 { font-size: 1.25rem; font-weight: 700; }
/* logo 链接也是触控目标，保持 ≥40px 点击区 */
.tp-header h1 a { color: #fff; display: inline-flex; align-items: center; min-height: 40px; }
.tp-nav { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.tp-nav a {
    color: #E5E7EB;
    padding: .45rem .7rem;
    border-radius: 6px;
    font-size: .85rem;
    white-space: nowrap;
    min-height: 40px; /* 触控目标 ≥40px */
    display: inline-flex;
    align-items: center;
}
.tp-nav a:hover { background: rgba(255, 255, 255, .12); }
.tp-nav a.active { background: var(--c-primary); color: #fff; }
.tp-nav a.tp-btn-exit { background: #C62828; }

.tp-container { max-width: 1180px; margin: 0 auto; padding: 1.25rem 1rem 2.5rem; }

.tp-footer {
    background: #2B2F33;
    color: #B9BEC4;
    text-align: center;
    padding: 1.25rem 1rem;
    font-size: .85rem;
}

/* ---------- 列表页：筛选区 ---------- */
.tp-page-title { font-size: 1.45rem; margin: .5rem 0 .25rem; }
.tp-page-desc { color: var(--c-text-sub); font-size: .9rem; margin-bottom: 1.25rem; }
.tp-filters {
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: center;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}
.tp-chip {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: .4rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--c-border);
    background: #fff;
    color: var(--c-text);
    font-size: .88rem;
    cursor: pointer;
}
.tp-chip:hover { border-color: var(--c-primary); color: var(--c-primary-dark); }
.tp-chip.on { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.tp-search-box { display: flex; flex: 1 1 240px; min-width: 210px; }
.tp-search-box input {
    flex: 1;
    min-height: 40px;
    border: 1px solid var(--c-border);
    border-right: none;
    border-radius: 8px 0 0 8px;
    padding: .4rem .8rem;
    font-size: .92rem;
    font-family: var(--font);
    outline: none;
}
.tp-search-box input:focus { border-color: var(--c-primary); }
.tp-search-box button {
    min-height: 40px;
    min-width: 64px;
    border: none;
    border-radius: 0 8px 8px 0;
    background: var(--c-primary);
    color: #fff;
    font-size: .9rem;
    cursor: pointer;
}
.tp-sort select {
    min-height: 40px;
    border: 1px solid var(--c-border);
    border-radius: 8px;
    padding: .3rem .5rem;
    font-size: .9rem;
    font-family: var(--font);
    background: #fff;
    color: var(--c-text);
}

/* ---------- 列表页：卡片网格 ---------- */
.tp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}
.tp-card {
    position: relative; /* 作为整卡可点伪元素的定位容器 */
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 1.15rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: .55rem;
    box-shadow: var(--shadow);
    transition: transform .18s ease, box-shadow .18s ease;
}
.tp-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(20, 24, 28, .1); }
.tp-card-top { display: flex; align-items: center; gap: .65rem; }
.tp-card-ico {
    width: 44px; height: 44px;
    flex: 0 0 44px;
    border-radius: 12px;
    background: var(--c-primary-light);
    color: var(--c-primary-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.tp-card-ico svg { width: 26px; height: 26px; }
.tp-card h3 { font-size: 1.02rem; line-height: 1.35; }
.tp-card h3 a { color: var(--c-text); }
.tp-card h3 a:hover { color: var(--c-primary-dark); }
/* 整卡可点：标题链接的伪元素铺满整张卡片（stretched-link 模式），
   原约 22px 高的纯文本点击区扩大为整卡；卡片内按钮需提高层级保持自身可点 */
.tp-card h3 a::after { content: ''; position: absolute; left: 0; top: 0; right: 0; bottom: 0; }
.tp-card p { color: var(--c-text-sub); font-size: .85rem; flex: 1; }
.tp-card .tp-tags { display: flex; gap: .4rem; flex-wrap: wrap; }
.tp-tag {
    font-size: .72rem;
    padding: .15rem .55rem;
    border-radius: 999px;
    background: #F0F2F4;
    color: var(--c-text-sub);
}
.tp-tag.warn { background: #FDECEA; color: var(--c-danger); }
.tp-card-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: .5rem 1.1rem;
    border-radius: 8px;
    background: var(--c-primary);
    color: #fff;
    font-size: .9rem;
    align-self: flex-start;
}
/* 整卡可点伪元素覆盖卡片时，按钮提升层级，保证自身 hover/点击正常 */
.tp-card-btn { position: relative; z-index: 1; }
.tp-card-btn:hover { background: var(--c-primary-dark); }
.tp-empty {
    background: var(--c-card);
    border: 1px dashed var(--c-border);
    border-radius: var(--radius);
    padding: 3rem 1rem;
    text-align: center;
    color: var(--c-text-sub);
}
.tp-section-title { font-size: 1.1rem; margin: 1.75rem 0 .9rem; }
.tp-section-note {
    background: #FFF8E1;
    border: 1px solid #F5E1A4;
    color: #8D6E00;
    font-size: .82rem;
    border-radius: 8px;
    padding: .6rem .8rem;
    margin-bottom: .9rem;
}

/* ---------- 工具页 ---------- */
.tp-tool-head {
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 1.1rem 1.2rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: .8rem;
    flex-wrap: wrap;
}
.tp-tool-head .tp-card-ico { width: 52px; height: 52px; flex-basis: 52px; }
.tp-tool-head h2 { font-size: 1.3rem; flex: 1 1 200px; }
.tp-tool-head p { width: 100%; color: var(--c-text-sub); font-size: .88rem; margin-top: .1rem; }
.tp-back {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .88rem;
    color: var(--c-text-sub);
    min-height: 40px;
    padding: .3rem .6rem;
    border-radius: 8px;
}
.tp-back:hover { background: #ECEFF2; color: var(--c-text); }

.tp-panel {
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 1.2rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.25rem;
}
.tp-panel h3 { font-size: 1.02rem; margin-bottom: .9rem; }

/* 表单：横向栅格，窄屏自动变单列 */
.tp-form-row { display: flex; flex-wrap: wrap; gap: .9rem 1rem; margin-bottom: 1rem; }
.tp-field { flex: 1 1 190px; display: flex; flex-direction: column; gap: .3rem; }
.tp-field > label { font-size: .85rem; color: var(--c-text-sub); }
.tp-field > label b { color: var(--c-text); font-weight: 600; }
.tp-input, .tp-select, .tp-textarea {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--c-border);
    border-radius: 8px;
    padding: .45rem .7rem;
    font-size: .95rem;
    font-family: var(--font);
    background: #fff;
    color: var(--c-text);
    outline: none;
}
.tp-input:focus, .tp-select:focus, .tp-textarea:focus { border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(76, 175, 80, .12); }
.tp-textarea { min-height: 130px; resize: vertical; line-height: 1.55; font-size: .9rem; }
.tp-field-inline { flex-direction: row; align-items: center; gap: .5rem; }

.tp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: .55rem 1.4rem;
    border: none;
    border-radius: 8px;
    background: var(--c-primary);
    color: #fff;
    font-size: .95rem;
    cursor: pointer;
    font-family: var(--font);
}
.tp-btn:hover { background: var(--c-primary-dark); }
.tp-btn:active { transform: translateY(1px); }
.tp-btn-ghost {
    background: #fff;
    color: var(--c-text);
    border: 1px solid var(--c-border);
}
.tp-btn-ghost:hover { background: #F2F4F6; }
.tp-btn-danger { background: var(--c-danger); }
.tp-btn-group { display: flex; flex-wrap: wrap; gap: .6rem; }

/* 单选/复选组（触控目标 ≥40px） */
.tp-radio-row { display: flex; flex-wrap: wrap; gap: .5rem .6rem; margin-bottom: 1rem; }
.tp-radio {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    min-height: 40px;
    padding: .35rem .9rem;
    border: 1px solid var(--c-border);
    border-radius: 999px;
    font-size: .88rem;
    cursor: pointer;
    background: #fff;
}
.tp-radio input { width: 16px; height: 16px; accent-color: var(--c-primary); }
.tp-radio.on { border-color: var(--c-primary); background: var(--c-primary-light); color: var(--c-primary-dark); }

/* 结果区 */
.tp-result {
    border: 1px solid var(--c-border);
    background: #FAFBFC;
    border-radius: 8px;
    padding: 1rem;
    font-size: .92rem;
    overflow-x: auto;
}
.tp-result table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tp-result th, .tp-result td { padding: .5rem .55rem; border-bottom: 1px solid var(--c-border); text-align: left; white-space: nowrap; }
.tp-result th { color: var(--c-text-sub); font-weight: 600; background: #F3F5F7; }
.tp-result tr:last-child td { border-bottom: none; }
.tp-result .hl { color: var(--c-primary-dark); font-weight: 700; font-size: 1.05rem; }
.tp-result ul { padding-left: 1.2rem; }
.tp-msg-error { color: var(--c-danger); }
.tp-msg-ok { color: var(--c-primary-dark); }
.tp-hint { font-size: .8rem; color: var(--c-text-sub); margin-top: .5rem; }
.tp-out-textarea { width: 100%; min-height: 110px; font-family: Consolas, Menlo, monospace; font-size: .85rem; }

/* 键值行（简单结果展示） */
.tp-kv { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; }
.tp-kv .k { color: var(--c-text-sub); }

/* 大号计时显示（番茄钟等） */
.tp-timer-big {
    font-size: 3rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: center;
    margin: .8rem 0;
    letter-spacing: .04em;
}

/* 颜色预览块 */
.tp-color-box { height: 90px; border-radius: 8px; border: 1px solid var(--c-border); }

/* ---------- 响应式（375px 无横向滚动） ---------- */
@media (max-width: 768px) {
    .tp-header { padding: .8rem .9rem; }
    .tp-header .tp-head-row { justify-content: center; text-align: center; }
    .tp-header h1 { font-size: 1.1rem; width: 100%; }
    .tp-nav { justify-content: center; }
    .tp-nav a { font-size: .78rem; padding: .35rem .55rem; min-height: 40px; }
    .tp-container { padding: .9rem .75rem 2rem; }
    .tp-grid { grid-template-columns: 1fr; }
    .tp-form-row { gap: .75rem; }
    .tp-field { flex: 1 1 100%; }
    .tp-search-box { flex: 1 1 100%; }
    .tp-btn { width: 100%; }
    .tp-btn-group .tp-btn { flex: 1 1 45%; }
    .tp-card-btn { align-self: stretch; text-align: center; }
    .tp-timer-big { font-size: 2.4rem; }
    .tp-filters { gap: .5rem; }
}
