body.timp-body {
    --timp-bg: #f4f6f4;
    --timp-surface: #fff;
    --timp-soft: #f4f7f6;
    --timp-ink: #17312f;
    --timp-muted: #60716e;
    --timp-line: #dce5e1;
    --timp-accent: #147d73;
    --timp-accent-ink: #fff;
    --timp-tint: #e5f3ed;
    --timp-error: #b3362b;
}

body.timp-body.dark-theme {
    --timp-bg: #111c1b;
    --timp-surface: #1a2927;
    --timp-soft: #203330;
    --timp-ink: #edf5f1;
    --timp-muted: #afc1b9;
    --timp-line: #354b44;
    --timp-accent: #7adac1;
    --timp-accent-ink: #112e27;
    --timp-tint: #243f35;
    --timp-error: #ffab9d;
    color-scheme: dark;
}

body#page-top.timp-body { background: var(--timp-bg); color: var(--timp-ink); }
.timp-main { width: min(960px, calc(100% - 40px)); margin: 36px auto 48px; flex: 1; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }
.timp-main [hidden] { display: none !important; }
.timp-heading { display: flex; align-items: center; gap: 17px; margin-bottom: 26px; }
.timp-logo { display: grid; place-items: center; flex: 0 0 60px; height: 60px; border: 1px solid var(--timp-line); border-radius: 19px; background: var(--timp-tint); color: var(--timp-accent); }
.timp-logo svg { width: 33px; height: 33px; }
.timp-heading h1 { font: 750 2.25rem/1.1 system-ui, sans-serif; letter-spacing: -.06em; margin: 0 0 7px; }
.timp-heading p { color: var(--timp-muted); margin: 0; font-size: .98rem; }
.timp-card { background: var(--timp-surface); border: 1px solid var(--timp-line); border-radius: 28px; box-shadow: 0 12px 45px #132c2110; padding: 26px 32px 32px; }
.timp-card-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.timp-eyebrow { color: var(--timp-muted); text-transform: uppercase; letter-spacing: .12em; font-size: .72rem; font-weight: 700; }
.timp-badge { display: inline-flex; align-items: center; gap: 7px; border-radius: 20px; padding: 6px 11px; background: var(--timp-soft); color: var(--timp-muted); font-size: .76rem; font-weight: 650; }
.timp-badge::before { content: ""; width: 6px; height: 6px; background: currentColor; border-radius: 50%; }
.timp-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; align-items: center; margin-top: 26px; }
.timp-display { min-width: 0; text-align: center; }
.timp-dial { position: relative; width: min(100%, 340px); aspect-ratio: 1; margin: 0 auto 18px; }
.timp-ring { position: absolute; inset: 0; width: 100%; height: 100%; fill: none; stroke-width: 5; }
.timp-ring-track { stroke: var(--timp-line); }
.timp-ring-progress { stroke: var(--timp-accent); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 0; transform: rotate(-90deg); transform-origin: center; transition: stroke-dashoffset .2s linear; }
.timp-readout { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.timp-dial-label { color: var(--timp-muted); font-size: .82rem; }
.timp-time { font-size: clamp(2.6rem, 4.6vw, 3.5rem); font-weight: 650; line-height: 1.2; letter-spacing: -.05em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.timp-units { color: var(--timp-muted); font-size: .67rem; word-spacing: 5px; }
.timp-units span { opacity: .4; }
.timp-status { margin: 0 0 6px; font-size: .9rem; font-weight: 600; }
.timp-end { min-height: 1.5em; font-size: .8rem; color: var(--timp-muted); margin: 0; }
.timp-form { min-width: 0; }
.timp-form fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.timp-form legend { float: none; width: auto; font-size: 1.15rem; font-weight: 650; letter-spacing: -.02em; margin-bottom: 18px; }
.timp-fields { display: grid; grid-template-columns: 1fr 8px 1fr 8px 1fr; gap: 8px; align-items: end; }
.timp-fields label { display: grid; gap: 7px; color: var(--timp-muted); font-size: .78rem; font-weight: 600; }
.timp-fields input { min-width: 0; width: 100%; height: 66px; padding: 8px 4px; border: 1px solid var(--timp-line); border-radius: 12px; background: var(--timp-soft); color: var(--timp-ink); font: 600 1.8rem/1 system-ui, sans-serif; font-variant-numeric: tabular-nums; text-align: center; }
.timp-fields input:disabled { opacity: .6; }
.timp-field-colon { align-self: end; padding-bottom: 19px; font-size: 1.2rem; color: var(--timp-muted); text-align: center; }
.timp-presets-label { font-size: .76rem; color: var(--timp-muted); margin: 18px 0 8px; }
.timp-presets { display: flex; flex-wrap: wrap; gap: 7px; }
.timp-main button { font-family: inherit; touch-action: manipulation; cursor: pointer; }
.timp-presets button { flex: 1; min-width: 52px; min-height: 40px; padding: 7px; border: 1px solid var(--timp-line); border-radius: 9px; font-size: .79rem; font-weight: 600; background: var(--timp-surface); color: var(--timp-muted); white-space: nowrap; }
.timp-presets button[aria-pressed="true"] { color: var(--timp-accent); background: var(--timp-tint); border-color: var(--timp-accent); }
.timp-actions { display: flex; gap: 10px; margin: 24px 0; }
.timp-actions button { min-height: 52px; border-radius: 12px; font-size: .93rem; font-weight: 650; padding: 12px 18px; }
.timp-primary { flex: 1; background: var(--timp-accent); color: var(--timp-accent-ink); border: 1px solid var(--timp-accent); }
.timp-secondary { color: var(--timp-ink); background: var(--timp-surface); border: 1px solid var(--timp-line); }
.timp-main button:disabled { opacity: .45; cursor: default; }
.timp-main button:not(:disabled):hover { filter: brightness(.94); }
.timp-main :is(button, input):focus-visible { outline: 3px solid var(--timp-accent); outline-offset: 3px; }
.timp-options { border-top: 1px solid var(--timp-line); padding-top: 17px; }
.timp-option-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; margin-bottom: 9px; }
.timp-check { display: flex; align-items: center; gap: 9px; font-size: .83rem; min-height: 28px; cursor: pointer; }
.timp-check input { width: 17px; height: 17px; accent-color: var(--timp-accent); margin: 0; flex-shrink: 0; }
.timp-test { min-height: 36px; padding: 4px 0; border: 0; background: transparent; color: var(--timp-accent); font-size: .76rem; text-decoration: underline; text-underline-offset: 3px; }
.timp-option-note, .timp-audio-note { font-size: .73rem; line-height: 1.5; color: var(--timp-muted); margin: 4px 0 0 26px; }
.timp-audio-note { margin-top: 10px; }
.timp-error { color: var(--timp-error); font-size: .83rem; margin: 14px 0 0; }
.timp-fields input[aria-invalid="true"] { border-color: var(--timp-error); }
.timp-phone-note { display: flex; align-items: flex-start; gap: 10px; max-width: 650px; margin: 22px auto 0; color: var(--timp-muted); font-size: .79rem; line-height: 1.65; }
.timp-phone-note svg { flex: 0 0 20px; height: 22px; margin-top: 2px; }
.timp-noscript { margin-top: 20px; color: var(--timp-error); }
.timp-card[data-state="running"] .timp-badge, .timp-card[data-state="finished"] .timp-badge { background: var(--timp-tint); color: var(--timp-accent); }
.timp-card[data-state="finished"] .timp-time, .timp-card[data-state="finished"] .timp-status { color: var(--timp-accent); }
.timp-card[data-state="finished"] .timp-dial { background: var(--timp-tint); border-radius: 50%; }
.timp-card[data-state="paused"] .timp-ring-progress { opacity: .45; }

@media (max-width: 700px) {
    .timp-main { width: min(480px, calc(100% - 28px)); margin-top: 22px; }
    .timp-heading { gap: 12px; margin-bottom: 20px; }
    .timp-logo { flex-basis: 48px; height: 48px; border-radius: 15px; }
    .timp-logo svg { width: 27px; height: 27px; }
    .timp-heading h1 { font-size: 1.8rem; }
    .timp-heading p { font-size: .82rem; }
    .timp-card { padding: 18px; border-radius: 22px; }
    .timp-layout { grid-template-columns: 1fr; gap: 22px; margin-top: 16px; }
    .timp-dial { width: 220px; margin-bottom: 12px; }
    .timp-time { font-size: 2.45rem; }
    .timp-status { font-size: .82rem; }
    .timp-form legend { font-size: 1rem; margin-bottom: 10px; }
    .timp-fields input { height: 54px; font-size: 1.5rem; }
    .timp-field-colon { padding-bottom: 13px; }
    .timp-presets-label { margin-top: 12px; }
    .timp-actions { margin: 18px 0; }
    .timp-presets button { min-width: 45px; padding-inline: 5px; }
    .timp-phone-note { padding: 0 5px; }
}

@media (prefers-reduced-motion: reduce) {
    .timp-ring-progress { transition: none; }
}
