@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600;9..144,700&family=Manrope:wght@400;500;700&display=swap");

:root {
    --bg-cream: #f8f2e6;
    --bg-mint: #d4ece5;
    --ink: #173237;
    --panel: rgba(255, 255, 255, 0.76);
    --accent-teal: #1c7f84;
    --accent-coral: #ef7b4a;
    --border: rgba(23, 50, 55, 0.16);
    --shadow: 0 22px 45px rgba(16, 46, 41, 0.18);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(1100px 700px at -15% -10%, #fffaf0 0%, transparent 60%),
        radial-gradient(900px 650px at 110% 110%, #c7e6df 0%, transparent 62%),
        linear-gradient(150deg, var(--bg-cream), var(--bg-mint));
    display: grid;
    place-items: center;
    padding: 1.2rem;
}

.app-shell {
    width: min(980px, 100%);
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 1rem;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(4px);
}

.controls {
    padding: 1.35rem;
}

h1 {
    margin: 0;
    font-family: "Fraunces", Georgia, serif;
    font-weight: 700;
    font-size: clamp(1.7rem, 2.6vw, 2.3rem);
    letter-spacing: 0.01em;
}

.subtitle {
    margin: 0.35rem 0 1rem;
    font-size: 0.97rem;
    opacity: 0.88;
}

.field-grid {
    display: grid;
    gap: 0.75rem;
}

.field {
    display: grid;
    gap: 0.4rem;
}

.field-label {
    font-weight: 700;
    font-size: 0.87rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.88;
}

input[type="number"] {
    width: 100%;
    border: 1px solid #8ab6b8;
    border-radius: 12px;
    padding: 0.64rem 0.8rem;
    font-size: 1rem;
    background: #fffdf9;
    color: var(--ink);
}

input[type="number"]:focus,
input[type="range"]:focus {
    outline: 2px solid rgba(28, 127, 132, 0.32);
    outline-offset: 1px;
}

.slider {
    width: 100%;
    accent-color: var(--accent-coral);
}

.toggle-grid {
    margin-top: 1rem;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.55rem;
}

.toggle {
    display: flex;
    gap: 0.45rem;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 1px solid rgba(28, 127, 132, 0.3);
    background: rgba(255, 255, 255, 0.88);
    border-radius: 999px;
    font-size: 0.83rem;
    font-weight: 700;
    padding: 0.5rem 0.65rem;
}

.toggle input[type="checkbox"] {
    accent-color: var(--accent-teal);
}

.actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.65rem;
}

.btn {
    border: 0;
    border-radius: 12px;
    padding: 0.72rem 1.1rem;
    font-size: 0.96rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 160ms ease, filter 160ms ease, opacity 160ms ease;
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.btn:not(:disabled):hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
}

.btn.start {
    color: #f8fff8;
    background: linear-gradient(115deg, #176f73, #0f5f68);
}

.btn.stop {
    color: #fff8f5;
    background: linear-gradient(115deg, #c96a3f, #ab5330);
}

.status {
    margin: 0.9rem 0 0;
    font-size: 0.92rem;
    font-weight: 700;
    color: #2c5b60;
}

.stage {
    padding: 1rem;
    display: grid;
    place-items: center;
}

#breathProgressCircle {
    width: clamp(230px, 38vw, 340px);
    aspect-ratio: 1 / 1;
    position: relative;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #ffffff 0%, #f3f7f3 58%, #d6ece8 100%);
    box-shadow:
        inset 0 0 0 1px rgba(27, 82, 86, 0.12),
        0 14px 32px rgba(23, 73, 64, 0.14);
}

#breathProgressCircle::after {
    content: "";
    position: absolute;
    inset: 12px;
    border-radius: 50%;
    border: 1px dashed rgba(28, 127, 132, 0.26);
    pointer-events: none;
}

#breathCircle {
    height: 86%;
    width: 86%;
    border-radius: 50%;
    background:
        radial-gradient(circle at 26% 24%, #f7fdf7 0%, #a7d9d5 36%, #2f8f94 72%, #1f5d66 100%);
    transform: scale3d(0.2, 0.2, 1);
    will-change: transform;
    animation-timing-function: ease-in-out;
    animation-iteration-count: 1;
    animation-direction: normal;
    animation-fill-mode: forwards;
    transform-origin: center;
    box-shadow: 0 14px 28px rgba(19, 79, 86, 0.27);
}

#txt {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    font-family: "Fraunces", Georgia, serif;
    font-size: clamp(1.2rem, 2.6vw, 1.85rem);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #0f5057;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.95);
    pointer-events: none;
}

@keyframes inhaleCircle {
    0% {
        transform: scale3d(0.2, 0.2, 1);
    }
    100% {
        transform: scale3d(1, 1, 1);
    }
}

@keyframes exhaleCircle {
    0% {
        transform: scale3d(1, 1, 1);
    }
    100% {
        transform: scale3d(0.2, 0.2, 1);
    }
}

@media (max-width: 840px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .controls {
        order: 2;
    }

    .stage {
        order: 1;
    }

    .toggle-grid {
        grid-template-columns: 1fr;
    }
}
