.timer-layout { flex: 1; display: flex; flex-direction: column; background: var(--tool-bg); }
.timer-main {
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    padding: 40px 16px;
    text-align: center;
}
.timer-main h1 { margin: 0 0 32px; }
.timer-page [hidden] { display: none !important; }
.timer-stage { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 374px; }
#timer-setup, .timer-display { grid-area: 1 / 1; }
.timer-display { display: flex; align-items: center; justify-content: center; justify-self: center; width: min(768px, calc(100vw - 32px)); padding-bottom: 24px; color: var(--tool-digits); font-size: clamp(40px, 12vw, 96px); font-weight: 400; font-variant-numeric: tabular-nums; line-height: 1.2; white-space: nowrap; }
#timer-digits { flex: 0 0 auto; }
.timer-finished-message, .timer-running-message, .timer-paused-message { grid-area: 1 / 1; align-self: end; margin: 0 0 24px; color: var(--tool-muted); font-size: 18px; line-height: 1.5; }
.timer-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.timer-label { margin-bottom: 12px; color: var(--tool-muted); font-size: 14px; }
.timer-wheel-frame { position: relative; }
.timer-wheel-frame::before {
    content: '';
    position: absolute;
    top: 112px;
    left: 0;
    right: 0;
    height: 56px;
    border-radius: 4px;
    background: var(--tool-surface);
    pointer-events: none;
}
.timer-wheel {
    position: relative;
    height: 280px;
    padding: 112px 0;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-snap-type: y mandatory;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
    scrollbar-width: none;
    font-variant-numeric: tabular-nums;
    mask-image: linear-gradient(to bottom, transparent, #000 25%, #000 75%, transparent);
}
.timer-wheel::-webkit-scrollbar { display: none; }
/* Keep the keyboard focus outline outside the masked scrolling content. */
.timer-wheel:focus-visible { outline: none; }
.timer-wheel-frame:has(.timer-wheel:focus-visible) { outline: 3px solid var(--tool-accent); outline-offset: 4px; border-radius: 4px; }
.timer-value {
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    scroll-snap-align: center;
    color: var(--tool-muted);
    font-size: 28px;
    line-height: 1;
    user-select: none;
    cursor: pointer;
}
.timer-value.is-selected { color: var(--tool-digits); font-size: 40px; font-weight: 600; cursor: default; }
.timer-wheel.is-dragging { scroll-snap-type: none; }
@media (hover: hover) and (pointer: fine) {
    .timer-wheel, .timer-wheel .timer-value { cursor: grab; }
}
.timer-wheel.is-dragging, .timer-wheel.is-dragging .timer-value { cursor: grabbing; }
.timer-help { margin: 16px 0 24px; color: var(--tool-muted); font-size: 14px; }
.timer-start {
    width: 100%;
    min-height: 48px;
    padding: 10px 16px;
    border: 1px solid var(--tool-accent);
    border-radius: 4px;
    background: var(--tool-accent);
    color: var(--tool-on-accent);
    font: 400 18px/1.5 var(--tool-font);
    cursor: pointer;
}
.timer-start:not(:disabled):hover { background: var(--tool-accent-hover); border-color: var(--tool-accent-hover); }
.timer-start:focus { box-shadow: 0 0 0 .2rem rgba(72, 180, 97, .5); }
.timer-start:not(:disabled):active { background: #1e7e34; border-color: #1c7430; color: #fff; }
.timer-start:disabled { opacity: .65; cursor: default; }
.timer-start.timer-pause { background: #ffc107; border-color: #ffc107; color: #212529; }
.timer-start.timer-pause:hover { background: #e0a800; border-color: #d39e00; }
.timer-start.timer-pause:focus { box-shadow: 0 0 0 .2rem rgba(222, 170, 12, .5); }
.timer-start.timer-pause:active { background: #d39e00; border-color: #c69500; color: #212529; }
.timer-start, .timer-reset {
    user-select: none;
    transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}
@media (prefers-reduced-motion: reduce) {
    .timer-start, .timer-reset { transition: none; }
}
.timer-controls { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 4fr) minmax(0, 3fr); gap: 8px; align-items: stretch; }
.timer-controls .timer-start { padding: 10px 8px; font-size: 16px; }
.timer-reset {
    justify-self: center;
    width: 76px;
    max-width: 100%;
    min-height: 48px;
    padding: 10px 8px;
    border: 1px solid #dc3545;
    border-radius: 4px;
    background: #dc3545;
    color: #fff;
    font: 400 16px/1.5 var(--tool-font);
    cursor: pointer;
}
.timer-reset:not(:disabled):hover { background: #c82333; border-color: #bd2130; }
.timer-reset:not(:disabled):focus { box-shadow: 0 0 0 .2rem rgba(225, 83, 97, .5); }
.timer-reset:not(:disabled):active { background: #bd2130; border-color: #b21f2d; }
.timer-reset:disabled {
    visibility: hidden;
    border-color: var(--tool-subtle);
    background: var(--tool-subtle);
    color: var(--tool-disabled);
    opacity: 1;
    cursor: default;
}
.timer-page:not(:lang(en)) .timer-reset { width: auto; min-width: min(76px, 100%); padding-inline: 2px; font-size: clamp(12px, 3vw, 18px); }
.timer-sound-options { display: flex; align-items: center; justify-content: center; gap: 4px; white-space: nowrap; }
.timer-sound { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 2px; cursor: pointer; }
.timer-sound input { flex: 0 0 auto; width: 18px; height: 18px; margin: 0; accent-color: var(--tool-accent); cursor: pointer; }
.timer-sound input:focus-visible { outline: 3px solid var(--tool-accent); outline-offset: 4px; }
.timer-presets { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 12px; }
.timer-presets-label { color: var(--tool-muted); white-space: nowrap; }
.timer-preset-options { display: flex; justify-content: center; gap: 8px; }
.timer-adjustments { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 4px; }
.timer-keyboard-entry { margin-top: 4px; }
.timer-section-nav { width: 100%; max-width: 800px; margin: 0 auto; padding: 0 16px 24px; }
.timer-section-nav ul { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; margin: 0; padding: 0; list-style: none; }
.timer-section-nav li { display: flex; align-items: center; max-width: 100%; }
.timer-section-nav a, .timer-section-nav [aria-current] { display: inline-flex; align-items: center; min-width: 0; min-height: 44px; }
.timer-section-nav [aria-current] { color: var(--tool-ink); font-weight: 600; cursor: default; }
.timer-nav-separator { flex: 0 0 auto; margin: 0 12px; color: var(--tool-muted); }
.timer-dialog {
    width: min(420px, calc(100% - 32px));
    max-height: calc(100dvh - 32px);
    padding: 24px;
    overflow-y: auto;
    border: 1px solid var(--tool-border);
    border-radius: 8px;
    background: var(--tool-bg);
    color: var(--tool-ink);
    text-align: left;
}
.timer-dialog::backdrop { background: rgba(0, 0, 0, .5); }
.timer-dialog h2 { margin: 0 44px 24px 0; font-size: 22px; font-weight: 500; }
.timer-dialog-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: none;
    color: var(--tool-muted);
    font: 28px/1 var(--tool-font);
    cursor: pointer;
}
.timer-dialog-close:hover { color: var(--tool-ink); background: var(--tool-surface); }
.timer-entry-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.timer-entry-fields label { display: block; margin-bottom: 8px; font-size: 14px; }
.timer-entry-fields input {
    width: 100%;
    min-height: 48px;
    padding: 8px;
    border: 1px solid var(--tool-border);
    border-radius: 4px;
    background: var(--tool-bg);
    color: var(--tool-digits);
    font: 24px/1.2 var(--tool-font);
    font-variant-numeric: tabular-nums;
    text-align: center;
}
.timer-entry-fields input:focus-visible { outline: 3px solid var(--tool-accent); outline-offset: 3px; }
.timer-entry-range { display: block; margin-top: 4px; color: var(--tool-muted); font-size: 13px; text-align: center; }
.timer-entry-set { margin-top: 24px; }
.timer-end-dialog { text-align: center; }
.timer-end-icon { display: block; margin: 20px auto 12px; color: var(--tool-muted); }
.timer-end-dialog h2 { margin: 0 0 8px; font-size: 32px; font-weight: 600; }
.timer-end-dialog p { margin: 0 0 16px; color: var(--tool-muted); font-size: 14px; }
.timer-end-dialog #timer-end-message, .timer-end-dialog #timer-sound-check-message { font-size: 28px; line-height: 1.35; }
#timer-end-duration, #timer-finished-duration, #timer-running-duration, #timer-paused-duration { font-weight: 700; white-space: nowrap; }
.timer-end-dialog #timer-play-sound { margin-bottom: 12px; }
@media (max-width: 599px) {
    .timer-controls { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) auto; gap: 6px; }
    .timer-sound { gap: 4px; }
}
@media (max-width: 359px) {
    .timer-sound-options, .timer-sound-options .clock-control { font-size: 12px; }
    .timer-controls .timer-start { font-size: 14px; }
    .timer-stage { min-height: 395px; }
    .timer-presets { gap: 4px; font-size: 14px; }
    .timer-presets .clock-control { font-size: 14px; }
    .timer-preset-options { gap: 2px; }
    .timer-page:not(:lang(en)) .timer-presets-label { font-size: 12px; }
    .timer-page:not(:lang(en)) .timer-preset-options { gap: 0; }
    .timer-adjustments { gap: 10px; font-size: 14px; }
    .timer-adjustments .clock-control { font-size: 14px; }
}
@media (min-width: 600px) {
    .timer-main { padding-top: 48px; }
    .timer-controls .timer-start, .timer-reset { font-size: 18px; }
    .timer-picker { gap: 16px; }
    .timer-value { font-size: 32px; }
    .timer-value.is-selected { font-size: 48px; }
    .timer-presets { gap: 12px; }
    .timer-preset-options { column-gap: 16px; }
    .timer-adjustments { gap: 16px; }
}
