/* ============================================================
   字数统计与阅读时长 · 工具页面专属样式
   依赖根目录 style.css 全局变量与导航/页脚基础样式
   ============================================================ */

/* ===== 页面头 ===== */
.tool-header {
    padding: 140px 0 40px;
    background: linear-gradient(180deg, #f0f5ff 0%, #ffffff 100%);
}
.tool-header-inner { text-align: center; max-width: 720px; margin: 0 auto; }
.tool-header-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--primary);
    background: var(--primary-light);
    border: 1px solid rgba(26, 110, 255, 0.18);
    padding: 6px 16px;
    border-radius: 100px;
    margin-bottom: 16px;
}
.tool-header h1 {
    font-size: clamp(26px, 4vw, 36px);
    font-weight: 900;
    color: var(--text);
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}
.tool-header p {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.8;
}

/* ===== 主区域 ===== */
.tool-main { padding: 32px 0 80px; background: var(--bg-warm); }

/* ===== 概览卡片 ===== */
.overview-panel {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.ov-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}
.ov-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.ov-primary {
    background: var(--primary-gradient);
    border-color: transparent;
    color: #fff;
}
.ov-label { font-size: 12px; font-weight: 600; opacity: 0.75; margin-bottom: 8px; }
.ov-primary .ov-label { color: rgba(255,255,255,0.85); }
.ov-value {
    font-size: clamp(22px, 2.4vw, 30px);
    font-weight: 900;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
    word-break: break-all;
}
.ov-sub { font-size: 12px; opacity: 0.6; margin-top: 6px; }

/* ===== 左右布局 ===== */
.tool-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

/* ===== 面板通用 ===== */
.panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #fbfcff 0%, #ffffff 100%);
}
.panel-head h2 { font-size: 16px; font-weight: 800; color: var(--text); }
.panel-actions { display: flex; gap: 8px; }

/* ===== 文本域 ===== */
#textInput {
    display: block;
    width: 100%;
    min-height: 340px;
    max-height: 560px;
    resize: vertical;
    border: none;
    outline: none;
    padding: 18px 20px;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.9;
    color: var(--text);
    background: #fff;
}
#textInput::placeholder { color: var(--text-light); }

.input-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 20px;
    font-size: 12px;
    color: var(--text-light);
    border-top: 1px solid var(--border);
    background: var(--bg-warm);
}

/* ===== 目标字数 ===== */
.target-box { padding: 16px 20px; border-top: 1px solid var(--border); }
.target-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}
.target-head label { font-size: 13px; font-weight: 600; color: var(--text); }
.target-head input {
    width: 120px;
    padding: 7px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    color: var(--text);
    outline: none;
    transition: var(--transition);
}
.target-head input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,110,255,0.12); }
.target-progress {
    height: 10px;
    background: var(--bg-warm);
    border: 1px solid var(--border);
    border-radius: 100px;
    overflow: hidden;
}
.target-bar {
    height: 100%;
    width: 0;
    background: var(--primary-gradient);
    border-radius: 100px;
    transition: width 0.3s ease, background 0.3s ease;
}
.target-bar.over { background: linear-gradient(135deg, #ff6b35 0%, #ff4757 100%); }
.target-info { font-size: 12px; color: var(--text-light); margin-top: 8px; }

/* ===== 操作区 ===== */
.op-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg-warm);
}
.tbtn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    background: #fff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}
.tbtn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.tbtn-primary {
    background: var(--primary-gradient);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 14px rgba(26,110,255,0.3);
}
.tbtn-primary:hover {
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(26,110,255,0.4);
    background: var(--primary-gradient);
    border-color: transparent;
}
.op-tip { font-size: 12px; color: var(--success); font-weight: 600; }

/* ===== 选项卡 ===== */
.tab-bar {
    display: flex;
    gap: 4px;
    padding: 12px 12px 0;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #fbfcff 0%, #ffffff 100%);
    overflow-x: auto;
    scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-btn {
    padding: 10px 16px;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    border-bottom: 2.5px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    transition: var(--transition);
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-pane { display: none; padding: 20px; min-height: 420px; }
.tab-pane.active { display: block; }

/* ===== 详细统计网格 ===== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
.stat-item {
    background: var(--bg-warm);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    transition: var(--transition);
}
.stat-item:hover { border-color: rgba(26,110,255,0.25); }
.stat-item .si-label { font-size: 12px; color: var(--text-light); margin-bottom: 4px; }
.stat-item .si-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.stat-item .si-value em { font-style: normal; font-size: 12px; font-weight: 500; color: var(--text-light); margin-left: 4px; }

/* ===== 关键词密度 ===== */
.kw-summary, .para-summary {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.7;
    padding: 12px 14px;
    background: var(--bg-warm);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
}
.kw-list { display: flex; flex-direction: column; gap: 10px; }
.kw-item { cursor: pointer; }
.kw-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 5px;
}
.kw-word { font-size: 14px; font-weight: 700; color: var(--text); }
.kw-word .kw-pos { font-size: 11px; font-weight: 500; color: var(--text-light); margin-left: 6px; }
.kw-count { font-size: 12px; color: var(--text-light); white-space: nowrap; }
.kw-count b { color: var(--primary); font-weight: 800; }
.kw-bar {
    height: 8px;
    background: var(--bg-warm);
    border: 1px solid var(--border);
    border-radius: 100px;
    overflow: hidden;
}
.kw-bar-fill {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: 100px;
    transition: width 0.4s ease;
}
.kw-empty {
    text-align: center;
    padding: 48px 16px;
    color: var(--text-light);
    font-size: 13px;
}

/* ===== 段落分析 ===== */
.para-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 460px;
    overflow-y: auto;
    padding-right: 4px;
}
.para-item {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-warm);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    font-family: inherit;
    width: 100%;
}
.para-item:hover { border-color: rgba(26,110,255,0.3); background: var(--primary-light); }
.para-idx {
    width: 30px; height: 30px;
    border-radius: 8px;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 13px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}
.para-preview {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.para-meta { font-size: 12px; color: var(--text-light); white-space: nowrap; }
.para-meta b { color: var(--text); font-weight: 700; }

/* ===== 阅读设置 ===== */
.set-group { margin-bottom: 26px; }
.set-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 10px;
}
.set-head h3 { font-size: 15px; font-weight: 700; color: var(--text); }
.set-value { font-size: 13px; color: var(--text-light); }
.set-value b { color: var(--primary); font-size: 16px; font-weight: 800; }

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 100px;
    background: linear-gradient(90deg, var(--primary) var(--fill, 40%), var(--border) var(--fill, 40%));
    outline: none;
    margin: 8px 0 12px;
    cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--primary);
    box-shadow: 0 2px 8px rgba(26,110,255,0.35);
    cursor: grab;
}
input[type="range"]::-moz-range-thumb {
    width: 14px; height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--primary);
    box-shadow: 0 2px 8px rgba(26,110,255,0.35);
    cursor: grab;
}

.set-presets { display: flex; gap: 8px; flex-wrap: wrap; }
.preset-btn {
    padding: 6px 14px;
    border: 1.5px solid var(--border);
    border-radius: 100px;
    background: #fff;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}
.preset-btn:hover { border-color: var(--primary); color: var(--primary); }
.preset-btn.active {
    background: var(--primary-gradient);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 3px 10px rgba(26,110,255,0.3);
}

.set-note {
    background: var(--primary-light);
    border: 1px solid rgba(26,110,255,0.15);
    border-radius: var(--radius-sm);
    padding: 16px 18px;
}
.set-note h4 { font-size: 13px; font-weight: 700; color: var(--primary); margin-bottom: 8px; }
.set-note ul { list-style: none; }
.set-note li {
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.8;
    padding-left: 16px;
    position: relative;
}
.set-note li::before {
    content: '';
    position: absolute;
    left: 0; top: 11px;
    width: 5px; height: 5px;
    background: var(--primary);
    border-radius: 50%;
}

/* ============================================================
   移动端适配（与官网内联样式规则保持一致）
   导航/页脚桌面端样式由根目录 style.css 决定，此处只做断点覆盖
   ============================================================ */
@media (max-width: 1024px) {
    .tool-layout { grid-template-columns: 1fr; }
    .overview-panel { grid-template-columns: repeat(2, 1fr); }
    .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    /* 顶部导航汉堡菜单（与官网规则一致） */
    .nav-links {
        display: none;
        position: absolute;
        top: 72px;
        left: 0; right: 0;
        background: white;
        flex-direction: column;
        padding: 16px 24px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
        gap: 4px;
        border-bottom: 1px solid var(--border);
        z-index: 999;
    }
    .nav-links.active { display: flex; }
    .mobile-toggle { display: flex; }

    /* 页脚单列 */
    .footer-grid { grid-template-columns: 1fr; gap: 32px; }

    /* 页面头 */
    .tool-header { padding: 116px 0 32px; }
    .tool-header p { font-size: 14px; }

    /* 主区域 */
    .tool-main { padding: 20px 0 56px; }
    .overview-panel { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .ov-card { padding: 14px 16px; }

    #textInput { min-height: 260px; font-size: 14px; padding: 14px 16px; }
    .panel-head { padding: 14px 16px; }
    .tab-pane { padding: 14px; min-height: 360px; }
    .stat-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .stat-item { padding: 12px; }
    .stat-item .si-value { font-size: 17px; }

    .para-item { grid-template-columns: 32px 1fr; }
    .para-meta { grid-column: 2; }
    .target-head input { width: 100px; }
    .op-bar .tbtn { flex: 1; justify-content: center; }
}

@media (max-width: 480px) {
    .overview-panel { grid-template-columns: 1fr 1fr; }
    .ov-value { font-size: 20px; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .set-presets .preset-btn { padding: 5px 10px; font-size: 11px; }
}
