:root {
    --warn: #d38927;
    --danger: #cf5342;
}

.timer-app {
    width: min(920px, 100%);
    margin: 0 auto;
    display: grid;
    gap: 12px;
}

.timer-stage,
.timer-controls {
    border: 1px solid;
    border-radius: 20px;
    box-shadow: var(--shadow-dark);
}

body.dark-mode .timer-stage,
body.dark-mode .timer-controls {
    background: var(--surface-dark);
    border-color: var(--border-dark);
}

body.light-mode .timer-stage,
body.light-mode .timer-controls {
    background: var(--surface-light);
    border-color: var(--border-light);
    box-shadow: var(--shadow-light);
}

.timer-stage {
    padding: 16px;
    display: flex;
    justify-content: center;
}

.ring-container {
    position: relative;
    width: min(82vw, 340px);
    aspect-ratio: 1;
    cursor: pointer;
    font-size: clamp(14px, 2.6vmin, 17px);
}

svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

circle {
    fill: none;
    stroke-width: 8;
}

.ring-bg {
    stroke: color-mix(in srgb, var(--text-dark) 14%, transparent);
}

body.light-mode .ring-bg {
    stroke: color-mix(in srgb, var(--text-light) 16%, transparent);
}

.ring-fill {
    fill: transparent;
}

.ring-progress {
    stroke-dasharray: 283;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.15s linear, stroke 0.25s;
}

.pulse {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { stroke-width: 8; opacity: 1; }
    50% { stroke-width: 12; opacity: 0.65; }
    100% { stroke-width: 8; opacity: 1; }
}

.ring-label {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

#timeDisplay {
    font-size: clamp(3em, 5em, 5.3em);
    line-height: 1;
    font-weight: 700;
}

#stateLabel {
    margin-top: 0.38em;
    font-size: clamp(0.7em, 0.95em, 1.1em);
    text-transform: uppercase;
    letter-spacing: 0.11em;
    color: var(--muted-dark);
}

body.light-mode #stateLabel {
    color: var(--muted-light);
}

#actionLabel {
    margin-top: 0.68em;
    font-size: clamp(0.9em, 1em, 1.16em);
    font-weight: 620;
    color: var(--accent);
    user-select: none;
}

.timer-controls {
    padding: 12px;
    display: grid;
    gap: 12px;
}

.interval-controls {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.interval-controls button {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    border: 1px solid;
    cursor: pointer;
    font-size: 1.4rem;
    line-height: 1;
    transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

body.dark-mode .interval-controls button {
    background: var(--surface-strong-dark);
    border-color: var(--border-dark);
    color: var(--text-dark);
}

body.light-mode .interval-controls button {
    background: var(--surface-strong-light);
    border-color: var(--border-light);
    color: var(--text-light);
}

.interval-controls button:active {
    transform: scale(0.95);
}

.presets {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.presets button {
    border-radius: 12px;
    border: 1px solid;
    height: 42px;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 620;
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

body.dark-mode .presets button {
    background: var(--surface-strong-dark);
    border-color: var(--border-dark);
    color: var(--text-dark);
}

body.light-mode .presets button {
    background: var(--surface-strong-light);
    border-color: var(--border-light);
    color: var(--text-light);
}

.presets button:active {
    transform: scale(0.96);
}

.presets .active {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    color: #fff !important;
}

@media (max-width: 600px) {
    .ring-container {
        width: min(84vw, 320px);
    }
}
