/* ======================================================================
 *  在线秒表 & 倒计时器 /tool/stopwatch
 * ====================================================================== */

.sw-card {
    padding: 22px;
    margin-bottom: 16px;
    background: var(--c-bg-card);
    border: 1.5px solid var(--c-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.sw-card.is-active { border-color: var(--c-primary); box-shadow: 0 0 0 4px var(--c-primary-soft); }
.sw-card-title { font-size: 15.5px; font-weight: 800; letter-spacing: -0.01em; margin-bottom: 16px; }

/* ---------- 显示 ---------- */
.sw-display {
    font-size: 52px;
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: 0.01em;
    text-align: center;
    color: var(--c-text);
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    padding: 10px 0 4px;
    word-break: keep-all;
}
.sw-display-cd { color: var(--c-primary); }
.sw-display.is-done { color: #ef4444; animation: sw-blink 1s steps(2, start) infinite; }
@keyframes sw-blink { 50% { opacity: 0.35; } }

/* ---------- 进度条 ---------- */
.sw-progress {
    height: 8px;
    margin: 6px 0 20px;
    background: var(--c-surface-soft);
    border-radius: 999px;
    overflow: hidden;
}
.sw-progress span {
    display: block;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, #22d3ee, #6366f1);
    border-radius: 999px;
    transition: width 0.2s linear;
}

/* ---------- 按钮 ---------- */
.sw-btns { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.sw-btn {
    min-width: 104px;
    height: 48px;
    padding: 0 22px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 800;
    color: var(--c-text-sub);
    background: var(--c-surface-soft);
    border: 1px solid var(--c-border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.16s ease;
}
.sw-btn:hover:not(:disabled) { color: var(--c-primary); border-color: var(--c-primary); background: var(--c-primary-soft); }
.sw-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.sw-btn-main { color: #fff; background: var(--c-primary); border-color: var(--c-primary); }
.sw-btn-main:hover:not(:disabled) { color: #fff; background: var(--c-primary); filter: brightness(1.08); }
.sw-btn-cd { background: #6366f1; border-color: #6366f1; }
.sw-btn-ghost { min-width: 88px; }

/* ---------- 计次 ---------- */
.sw-laps { margin-top: 20px; border-top: 1px solid var(--c-border); padding-top: 14px; }
.sw-laps-head,
.sw-laps-row {
    display: grid;
    grid-template-columns: 74px 1fr 1fr;
    gap: 8px;
    align-items: center;
    padding: 9px 8px;
    font-size: 13.5px;
    font-variant-numeric: tabular-nums;
}
.sw-laps-head { font-size: 12px; font-weight: 800; color: var(--c-text-muted); }
.sw-laps-body { max-height: 260px; overflow-y: auto; }
.sw-laps-row { border-radius: 8px; color: var(--c-text-sub); }
.sw-laps-row:nth-child(odd) { background: var(--c-surface-soft); }
.sw-laps-row .n { font-weight: 800; color: var(--c-text); }
.sw-laps-row .lap { font-weight: 700; }
.sw-laps-row.is-fast { color: #10b981; }
.sw-laps-row.is-slow { color: #ef4444; }
.sw-laps-row .mark { font-size: 11px; font-weight: 800; margin-left: 6px; }
.sw-clear-laps {
    margin-top: 12px;
    padding: 8px 14px;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--c-text-muted);
    background: transparent;
    border: 1px solid var(--c-border);
    border-radius: 9px;
    cursor: pointer;
}
.sw-clear-laps:hover { color: #ef4444; border-color: #ef4444; }

/* ---------- 倒计时输入 ---------- */
.sw-cd-inputs { display: flex; gap: 10px; justify-content: center; margin-bottom: 14px; }
.sw-cd-field { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.sw-cd-field input {
    width: 84px;
    height: 52px;
    text-align: center;
    font-family: inherit;
    font-size: 22px;
    font-weight: 800;
    color: var(--c-text);
    background: var(--c-surface-soft);
    border: 1.5px solid var(--c-border);
    border-radius: 11px;
    outline: none;
    font-variant-numeric: tabular-nums;
}
.sw-cd-field input:focus { border-color: #6366f1; box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15); }
.sw-cd-field span { font-size: 12px; font-weight: 700; color: var(--c-text-muted); }

.sw-presets { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 18px; }
.sw-presets button {
    padding: 7px 14px;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--c-text-sub);
    background: var(--c-surface-soft);
    border: 1px solid var(--c-border);
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.sw-presets button:hover { color: #6366f1; border-color: #6366f1; background: rgba(99, 102, 241, 0.10); }

.sw-opt { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; font-size: 13px; font-weight: 700; color: var(--c-text-sub); cursor: pointer; }
.sw-opt input { width: 16px; height: 16px; cursor: pointer; }

.sw-done {
    margin-top: 14px;
    padding: 12px;
    text-align: center;
    font-size: 16px;
    font-weight: 800;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.10);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 11px;
}

/* ---------- 快捷键 ---------- */
.sw-keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.sw-key { display: flex; align-items: center; gap: 10px; padding: 10px 13px; background: var(--c-surface-soft); border: 1px solid var(--c-border); border-radius: 11px; font-size: 13px; color: var(--c-text-sub); }
.sw-key kbd {
    min-width: 30px;
    padding: 4px 9px;
    text-align: center;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 800;
    color: var(--c-text);
    background: var(--c-bg-card);
    border: 1px solid var(--c-border);
    border-bottom-width: 2px;
    border-radius: 7px;
}
.sw-tip { margin-top: 12px; font-size: 12.5px; color: var(--c-text-muted); }

.sw-info-block { margin: 24px 0 8px; }

@media (max-width: 560px) {
    .sw-display { font-size: 40px; }
    .sw-cd-field input { width: 66px; height: 48px; font-size: 19px; }
    .sw-btn { flex: 1 1 auto; min-width: 0; }
}
