.timer-page {
    font-family: "Open Sans", sans-serif;
    line-height: 1.4;
    color: #1c2833;
}

.timer-page h1 {
    margin: 1.1rem auto 0.35rem;
    text-align: center;
}

.timer-lead {
    max-width: 40rem;
    margin: 0 auto;
    text-align: center;
    color: #555;
    font-size: 1.05rem;
    line-height: 1.5;
}

.timer-app {
    max-width: 880px;
    margin: 1.35rem auto 2rem;
    padding: 1.25rem 1.1rem 1.15rem;
    text-align: center;
    background: #f6f3ec;
    border: 1px solid #e4dccb;
    border-radius: 18px;
}

.timer-app button {
    font-family: "Open Sans", sans-serif;
    height: auto;
    min-height: 44px;
    margin: 0;
    line-height: 1.2;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 10px;
    padding: 0.4rem 0.9rem;
    background: #fff;
    color: #163a66;
    border: 1px solid #c5d0dc;
    box-shadow: none;
    cursor: pointer;
}

.timer-app button:hover {
    background: #e8eef6;
    color: #163a66;
}

.timer-app button:disabled {
    background: #eceae4;
    border-color: #ddd6c8;
    color: #9aa3ab;
    cursor: not-allowed;
}

.timer-app button:focus-visible,
.timer-app input:focus-visible {
    outline: 3px solid #0a345c;
    outline-offset: 2px;
}

.timer-views {
    display: inline-flex;
    padding: 3px;
    background: #fff;
    border: 1px solid #c5d0dc;
    border-radius: 999px;
    gap: 2px;
}

.timer-views button {
    min-height: 36px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    padding: 0.3rem 1.05rem;
}

.timer-views button:hover {
    background: #eef3f8;
}

.timer-views button[aria-selected="true"],
.timer-views button[aria-selected="true"]:hover {
    background: #1875d0;
    color: #fff;
}

.timer-stage {
    position: relative;
    margin: 0.85rem auto 0.35rem;
}

.timer-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.timer-panel[hidden],
.timer-alarm[hidden],
.timer-badge[hidden],
.timer-unit-hr,
.timer-colon-hr {
    display: none !important;
}

.timer-badge {
    display: inline-block;
    margin: 0 0 0.45rem;
    padding: 0.22rem 0.7rem;
    border-radius: 999px;
    background: #fff4d6;
    color: #8a5a00;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.78rem;
}

.timer-clock {
    width: min(100%, 400px);
    height: auto;
    overflow: visible;
    filter: drop-shadow(0 10px 18px rgba(28, 40, 51, 0.12));
}

.timer-readout {
    margin: 0.45rem 0 0;
    font-size: clamp(1.8rem, 5vw, 2.7rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    color: #1c2833;
}

.timer-digits {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 0.35rem;
    min-height: 9.5rem;
    user-select: none;
}

.timer-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 4.2rem;
}

.timer-num {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 0.85;
    color: #1c2833;
}

.timer-hr-num,
.timer-min-num {
    font-size: clamp(4.6rem, 16vw, 8.4rem);
}

.timer-sec-num {
    font-size: clamp(2rem, 7vw, 3.5rem);
}

.timer-digits.is-final .timer-min-num {
    font-size: clamp(2rem, 7vw, 3.5rem);
    color: #8a94a0;
}

.timer-digits.is-final .timer-sec-num {
    font-size: clamp(4.6rem, 16vw, 8.4rem);
    color: #c23b2e;
}

.timer-unit-label {
    margin-top: 0.35rem;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6c7a88;
}

.timer-colon {
    padding-bottom: 1.35rem;
    font-size: clamp(2.4rem, 8vw, 4.2rem);
    font-weight: 700;
    line-height: 0.85;
    color: #1c2833;
}

.timer-app.is-hours .timer-unit-hr,
.timer-app.is-hours .timer-colon-hr {
    display: flex !important;
}

.timer-app.is-hours .timer-colon-hr {
    display: block !important;
}

.timer-track {
    width: min(100%, 520px);
    height: 14px;
    margin: 1.15rem auto 0.2rem;
    background: #e4e0d6;
    border-radius: 999px;
    overflow: hidden;
}

.timer-fill {
    width: 100%;
    height: 100%;
    background: #1875d0;
    border-radius: inherit;
    transform-origin: left center;
    transform: scaleX(1);
}

.timer-app.is-final .timer-fill {
    background: #e09a12;
}

.timer-app.is-low .timer-readout,
.timer-app.is-low .timer-num,
.timer-app.is-low .timer-colon {
    color: #c23b2e;
}

.timer-app.is-low .timer-rim {
    stroke: #c23b2e;
}

.timer-app.is-low .timer-fill {
    background: #c23b2e;
}

.timer-app.is-done .timer-rim {
    stroke: #e0a106;
}

.timer-app.is-done .timer-clock,
.timer-app.is-done .timer-digits {
    animation: timer-wiggle 0.55s ease-in-out 2;
    transform-origin: 50% 45%;
}

.timer-alarm {
    margin-top: 0.65rem;
}

.timer-alarm-title {
    margin: 0 0 0.55rem;
    font-size: clamp(2rem, 6vw, 3.3rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.05;
    color: #c23b2e;
}

.timer-confetti {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    overflow: visible;
    pointer-events: none;
}

.timer-bit {
    position: absolute;
    top: 38%;
    width: 9px;
    height: 14px;
    border-radius: 2px;
    animation: timer-pop 900ms ease-out forwards;
}

.timer-presets,
.timer-actions,
.timer-options,
.timer-custom {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.45rem;
}

.timer-presets {
    margin-top: 0.85rem;
    gap: 0.35rem;
}

.timer-presets button {
    border-radius: 999px;
    min-height: 40px;
    padding: 0.28rem 0.48rem;
}

.timer-presets button[aria-pressed="true"],
.timer-presets button[aria-pressed="true"]:hover {
    background: #1875d0;
    border-color: #135ba2;
    color: #fff;
}

.timer-custom {
    gap: 1.1rem;
    margin-top: 0.95rem;
}

.timer-custom label {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #5c6b7a;
}

.timer-custom input {
    width: 5rem;
    padding: 0.4rem 0.35rem;
    border: 1px solid #c5d0dc;
    border-radius: 8px;
    background: #fff;
    color: #1c2833;
    font-family: "Open Sans", sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.timer-custom input:disabled {
    background: #eceae4;
    color: #9aa3ab;
}

.timer-actions,
.timer-options {
    margin-top: 0.85rem;
}

.timer-start,
.timer-start:hover {
    background: #1875d0;
    border-color: #135ba2;
    color: #fff;
    min-width: 7.5rem;
    font-size: 1.08rem;
}

.timer-start[data-mode="pause"],
.timer-start[data-mode="pause"]:hover {
    background: #f0b429;
    border-color: #c48a0a;
    color: #1c2833;
}

.timer-options button[aria-pressed="true"] {
    background: #e7f2fb;
    border-color: #1875d0;
    color: #0f4f86;
}

.timer-options button[aria-pressed="true"]:hover {
    background: #d7e8f8;
    color: #0f4f86;
}

.timer-hint {
    margin: 0.85rem 0 0;
    color: #7a8794;
    font-size: 0.92rem;
    line-height: 1.4;
}

.timer-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@keyframes timer-wiggle {
    0%, 100% { transform: rotate(0deg); }
    20% { transform: rotate(-3.5deg); }
    40% { transform: rotate(3.5deg); }
    60% { transform: rotate(-2deg); }
    80% { transform: rotate(2deg); }
}

@keyframes timer-pop {
    0% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
    100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; }
}

.timer-app:fullscreen,
.timer-app:-webkit-full-screen {
    width: 100%;
    height: 100%;
    max-width: none;
    margin: 0;
    border: 0;
    border-radius: 0;
    overflow: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #f6f3ec;
}

.timer-app:fullscreen .timer-clock,
.timer-app:-webkit-full-screen .timer-clock {
    width: min(58vh, 520px);
}

.timer-app:fullscreen .timer-hr-num,
.timer-app:fullscreen .timer-min-num,
.timer-app:-webkit-full-screen .timer-hr-num,
.timer-app:-webkit-full-screen .timer-min-num {
    font-size: clamp(6rem, 20vh, 11rem);
}

.timer-app:fullscreen .timer-sec-num,
.timer-app:-webkit-full-screen .timer-sec-num {
    font-size: clamp(2.4rem, 8vh, 4.2rem);
}

.timer-app:fullscreen .timer-digits.is-final .timer-min-num,
.timer-app:-webkit-full-screen .timer-digits.is-final .timer-min-num {
    font-size: clamp(2.4rem, 8vh, 4.2rem);
}

.timer-app:fullscreen .timer-digits.is-final .timer-sec-num,
.timer-app:-webkit-full-screen .timer-digits.is-final .timer-sec-num {
    font-size: clamp(6rem, 20vh, 11rem);
}

@media (max-width: 640px) {
    .timer-app {
        padding: 1rem 0.7rem 0.95rem;
        border-radius: 14px;
    }

    .timer-clock {
        width: min(100%, 300px);
    }

    .timer-presets button {
        padding: 0.28rem 0.65rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .timer-app.is-done .timer-clock,
    .timer-bit {
        animation: none;
    }

    .timer-bit {
        display: none;
    }
}
