:root {
    --background-color: #0d0d0d;
    --foreground-color: #f5f5f5;
    --dimmed-color: #ababab;
    --line-color: #2a2a2a;
    --active-color: #353535;
}

[data-theme="light"] {
    --background-color: #f7f7f7;
    --foreground-color: #111111;
    --dimmed-color: #545454;
    --line-color: #d8d8d8;
    --active-color: #e0e0e0;
}

@font-face {
    font-family: "JetBrains Mono";
    src: url("/jetbrains-mono.woff2");
    font-weight: 400 700;
    font-display: block;
}

* {
    margin: 0;
    user-select: none;
    box-sizing: border-box;
    font-family: "JetBrains Mono", monospace;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    -moz-user-select: none;
}

.theme-change *,
.theme-change *::after {
    transition-property: transform !important;
}

[hidden] {
    display: none !important;
}

html {
    overscroll-behavior: none;
}

body {
    overflow: hidden;
    overscroll-behavior: none;
    background: var(--background-color);
    color: var(--foreground-color);
}

button {
    font: inherit;
    background: none;
    color: inherit;
    border: 0;
    cursor: pointer;
}

button:focus-visible {
    outline: none;
}

svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

svg.stroke {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: square;
}

.container {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0;
}

.clock {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
    container-type: size;
    cursor: pointer;
    transition: background 0.25s, opacity 0.25s;
}

.clock:first-child {
    rotate: 180deg;
}

.clock.active {
    background: var(--active-color);
}

.clock.waiting {
    opacity: 0.5;
}

.clock-time {
    font-size: min(25cqw, calc(150cqw / var(--chars, 5)), 45cqh);
    font-weight: 700;
    letter-spacing: -.035em;
    line-height: 1;
}

.clock.timed-out .clock-time {
    opacity: 0.25;
    text-decoration: line-through;
}

.periods {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    min-height: 10px;
    max-width: 80%;
}

.periods i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--foreground-color);
}

.periods.main-time i {
    background: none;
    border: 2px solid var(--foreground-color);
}

.controls {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    gap: 16px;
}

.controls button {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--background-color);
    border: 1px solid var(--line-color);
}

.settings {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0;
    padding-top: max(24px, env(safe-area-inset-top));
    padding-right: max(24px, env(safe-area-inset-right));
    padding-left: max(24px, env(safe-area-inset-left));
    padding-bottom: max(24px, env(safe-area-inset-bottom));
    background: var(--background-color);
    overflow: hidden;
}

.close-settings {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    margin-left: -14px;
    flex: none;
}

.settings-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-height: 0;
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    padding-top: 24px;
}

.settings-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    min-height: 40px;
}

.switch {
    width: 44px;
    height: 24px;
    border-radius: 12px;
    background: var(--line-color);
    position: relative;
    flex: none;
    transition: background 0.25s;
}

.switch::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--background-color);
    transition: transform 0.25s;
}

.switch.on {
    background: var(--foreground-color);
}

.switch.on::after {
    transform: translateX(20px);
}

.fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    padding-top: 24px;
}

.fields label {
    display: block;
    font-size: 0.75rem;
    color: var(--dimmed-color);
    margin-bottom: 6px;
}

.stepper {
    display: flex;
    align-items: center;
    border: 1px solid var(--line-color);
    border-radius: 18px;
    overflow: hidden;
}

.stepper button {
    width: 36px;
    height: 36px;
    flex: none;
    font-size: 1.15rem;
}

.stepper button:active {
    background: var(--foreground-color);
    color: var(--background-color);
}

.stepper output {
    flex: 1;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 700;
}

@media (min-aspect-ratio: 1) {
    .container {
        flex-direction: row;
    }

    .clock:first-child {
        rotate: none;
    }

    .controls {
        flex-direction: column;
    }

    .settings-body {
        max-width: 900px;
        flex-direction: row;
        gap: 56px;
    }

    .settings-column {
        flex: 1;
    }

    .settings-column + .settings-column {
        border-left: 1px solid var(--line-color);
        padding-left: 56px;
    }

    .fields {
        padding-top: 0;
    }
}
