







:root {
    --bg-color:      #141513;
    --surface-color: #20211E;
    --accent-color:  #C5A883;
    --active-color:  #30312B;
    --text-color:    #E8E2D9;
    --btn-border:    rgba(255, 255, 255, 0.1);
    --input-bg:      #292A25;
    --pill-bg:       rgba(255, 255, 255, 0.05);
}

.theme-light {
    --bg-color:      #EEE9DF;
    --surface-color: #FFFFFF;
    --accent-color:  #806244;
    --active-color:  #EEF0F2;
    --text-color:    #1A1D21;
    --btn-border:    rgba(0, 0, 0, 0.1);
    --input-bg:      #EEF0F2;
    --pill-bg:       rgba(0, 0, 0, 0.04);
}



.theme-toggle,
.audio-toggle {
    position: absolute;
    top: 40px;
    background: none;
    border: 1px solid var(--btn-border);
    color: var(--text-color);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.15s ease, opacity 0.2s ease, background 0.3s ease, border-color 0.3s ease;
}

.theme-toggle:hover,
.audio-toggle:hover {
    background: var(--active-color);
}

.theme-toggle { right: 20px; }

.audio-toggle {
    left: 20px;
    overflow: hidden;
}

.audio-toggle::after {
    content: "";
    position: absolute;
    width: 150%;
    height: 1.5px;
    background-color: var(--text-color);
    transform: rotate(-45deg) translateY(0);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    z-index: 2;
}

.audio-toggle.is-muted::after {
    opacity: 1;
}





.presets-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: opacity 0.4s ease, max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1), margin 0.5s ease;
}



.presets-arrow {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--pill-bg);
    border: 1px solid var(--btn-border);
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease, background 0.2s ease;
    pointer-events: none;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    z-index: 2;
}

.presets-wrapper:hover .presets-arrow,
.presets-wrapper.arrows-visible .presets-arrow {
    opacity: 1;
    pointer-events: auto;
}

.presets-arrow:hover {
    background: var(--active-color);
}

.presets-arrow:disabled {
    opacity: 0.15 !important;
    pointer-events: none;
}

.presets-gallery {
    flex: 1;
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 4px 2px 10px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-behavior: smooth;
}

.presets-gallery::-webkit-scrollbar {
    display: none;
}

.preset-card {
    flex: 0 0 auto;
    width: 130px;
    min-height: 100px;
    padding: 11px 13px;
    background: var(--pill-bg);
    border: 1px solid var(--btn-border);
    border-radius: 14px;
    cursor: pointer;
    scroll-snap-align: start;
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 3px;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.preset-card:hover {
    background: var(--active-color);
}

.preset-card:active {
    transform: scale(0.96);
}

.preset-card.is-active {
    background: var(--active-color);
    box-shadow: inset 0 0 0 1px var(--accent-color);
}

.preset-card__category {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent-color);
}

.preset-card__name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-color);
    line-height: 1.3;
}

.preset-card__desc {
    font-size: 11px;
    font-weight: 300;
    color: var(--text-color);
    opacity: 0.7;
    line-height: 1.4;
    flex-grow: 1;
}

.preset-card__pattern {
    font-size: 11px;
    font-weight: 400;
    color: var(--accent-color);
    letter-spacing: 0.03em;
    margin-top: auto;
    padding-top: 6px;
}

.pattern-label {
    font-family: inherit;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.2rem;
    color: var(--text-color);
    text-transform: uppercase;
}



@keyframes hold-pulse-full {
    0%,  100% { transform: scale(1);    }
    50%       { transform: scale(1.02); }
}

@keyframes hold-pulse-empty {
    0%,  100% { transform: scale(0.82); }
    50%       { transform: scale(0.84); }
}

.circle {
    --size: 60vw;
    --phase-duration: 4s;
    max-width: 280px;
    max-height: 280px;
    min-width: 150px;
    min-height: 150px;
    width:  var(--size);
    height: var(--size);
    border: 2px solid var(--accent-color);
    border-radius: 50%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0.82);
    transition: transform var(--phase-duration) cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.4s ease;
    will-change: transform;
}

.circle__glow {
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 4px solid var(--accent-color);
    filter: blur(10px);
    opacity: 0;
    transition: opacity 0.6s ease;
    pointer-events: none;
}

.circle.phase-inhale {
    transform: scale(1);
}
.circle.phase-inhale .circle__glow {
    opacity: 0.6;
}

.circle.phase-hold-in {
    transform: scale(1);
    animation: hold-pulse-full 2s ease-in-out infinite;
}
.circle.phase-hold-in .circle__glow {
    opacity: 0.35;
    transition: opacity 0.4s ease;
}

.circle.phase-exhale {
    transform: scale(0.82);
}

.circle.phase-hold-out {
    transform: scale(0.82);
    animation: hold-pulse-empty 2s ease-in-out infinite;
}

.circle__content {
    position: relative;
    z-index: 2;
    font-family: inherit;
    font-size: 32px;
    font-weight: 300;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: center;
    color: var(--text-color);
    user-select: none;
}

.controls {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 20px;
}

.controls__pill {
    display: flex;
    gap: 4px;
    background: var(--pill-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--btn-border);
    border-radius: 50px;
    padding: 6px;
}

.controls__btn {
    background: none;
    border: 1px solid transparent;
    color: var(--text-color);
    width: 52px;
    height: 52px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}

.controls__btn:not(:disabled):hover {
    background: var(--active-color);
    border-color: var(--btn-border);
}

.controls__btn:disabled,
.theme-toggle:disabled,
.audio-toggle:disabled {
    opacity: 0.2;
    cursor: not-allowed;
    pointer-events: none;
}

.toggle-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 5px;
}

.toggle-input {
    display: none;
}

.toggle-label {
    display: block;
    height: 52px;
    line-height: 52px;
    padding: 0 16px;
    background: var(--input-bg);
    border: 1px solid var(--btn-border);
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.85;
}

.toggle-label:hover {
    background: var(--active-color);
}

.toggle-input:checked + .toggle-label {
    background: var(--active-color);
    border-color: var(--accent-color);
    color: var(--text-color);
    opacity: 1;
}

.toggle-input:disabled + .toggle-label {
    opacity: 0.3;
    cursor: not-allowed;
}

.modal::backdrop {
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
}

.modal {
    background: var(--surface-color);
    border: 1px solid var(--btn-border);
    border-radius: 16px;
    padding: 24px;
    color: var(--text-color);
    max-width: 340px;
    width: 90%;
    position: fixed;
    inset: 0;
    margin: auto;
    height: fit-content;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
    transition: background 0.3s ease;
}

.modal__form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.modal__divider {
    height: 1px;
    background: var(--btn-border);
    margin: 4px 0;
}

.modal__field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.modal__field > label {
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.5;
}

.modal__field input[type="number"] {
    background: var(--input-bg);
    border: none;
    border-radius: 12px;
    padding: 0 14px;
    height: 52px;
    color: var(--text-color);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: box-shadow 0.2s ease;
    -moz-appearance: textfield;
}

.modal__field input[type="number"]::-webkit-outer-spin-button,
.modal__field input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.modal__field input[type="number"]:focus {
    box-shadow: 0 0 0 2px var(--accent-color);
}

.modal__field input.invalid {
    box-shadow: 0 0 0 2px #e05252;
}

.input--select {
    background: var(--input-bg);
    border: none;
    border-radius: 12px;
    padding: 0 40px 0 14px;
    height: 52px;
    color: var(--text-color);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    transition: box-shadow 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    /* Стрелка вниз для темной темы */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23E1E4E8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
}

.theme-light .input--select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231A1D21' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

.input--select:focus {
    box-shadow: 0 0 0 2px var(--accent-color);
}

.input--select option {
    background: var(--surface-color);
    color: var(--text-color);
    padding: 16px 14px;
    font-size: 1.1rem;
    line-height: 1.4;
    cursor: pointer;
    min-height: 52px;
}

.input--select optgroup {
    font-weight: 600;
    font-style: normal;
    color: var(--accent-color);
    padding: 12px 14px;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    cursor: pointer;
}

.input--select optgroup option {
    padding-left: 24px;
}

.input--select option:hover,
.input--select option:focus,
.input--select option:active {
    background: var(--active-color) !important;
}

.input--select option:checked {
    background: var(--accent-color) !important;
    color: white;
}

.modal__error {
    font-size: 0.75rem;
    color: #e05252;
    min-height: 1em;
}

.modal__actions {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}

.modal__btn {
    flex: 1;
    height: 52px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
    font-weight: 500;
    background: var(--input-bg);
    border: 1px solid var(--btn-border);
    color: var(--text-color);
    transition: background 0.2s ease, opacity 0.2s ease;
}

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

.modal__btn--primary {
    background: var(--accent-color);
    border: none;
    color: #fff;
}

.modal__btn--primary:hover {
    opacity: 0.88;
    background: var(--accent-color);
}


/* Breathwork is a tab, not a standalone full-screen page. */
.breath-view { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.breath-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex: 0 0 auto; }
.breath-toolbar .theme-toggle, .breath-toolbar .audio-toggle { position: relative; inset: auto; width: 44px; height: 44px; min-height: 44px; padding: 0; flex-shrink: 0; background: transparent; color: var(--text-color); border: 1px solid var(--btn-border); border-radius: 50%; }
.breath-view .app { display: flex; flex-direction: column; align-items: stretch; gap: 12px; min-width: 0; width: 100%; flex: 1 0 auto; }
.breath-view .presets-wrapper { min-width: 0; flex: 0 0 auto; gap: 6px; overflow: hidden; }
.breath-view .presets-wrapper.is-hidden { display: none; }
.breath-view .presets-gallery { min-width: 0; flex: 1 1 0; padding: 2px 2px 6px; }
.breath-view .preset-card { width: clamp(114px, 37vw, 148px); min-height: 116px; padding: 11px 12px; background: var(--pill-bg); color: var(--text-color); justify-content: flex-start; overflow-wrap: anywhere; }
.breath-view .preset-card.is-active { background: var(--active-color); }
.breath-view .presets-arrow { flex: 0 0 28px; width: 28px; height: 32px; min-height: 32px; padding: 0; background: var(--pill-bg); color: var(--text-color); }
.breath-view .app__visual { display: flex; flex: 1 0 auto; justify-content: center; align-items: center; min-width: 0; min-height: calc(clamp(132px, 54vw, 260px) + 16px); padding: 8px 0; }
.breath-view .circle { --size: clamp(132px, 54vw, 260px); width: var(--size); height: var(--size); min-height: 0; min-width: 0; flex: 0 0 auto; }
.breath-view .circle__content { font-size: clamp(18px, 5vw, 28px); }
.breath-view .controls { flex: 0 0 auto; margin: 0; padding: 0; min-height: 0; }
.breath-view .controls__btn { padding: 0; background: transparent; color: var(--text-color); }
.breath-view .controls__btn:not(:disabled):hover { background: var(--active-color); }
.modal { max-height: calc(100dvh - 32px); overflow-y: auto; margin: auto; }
.modal input[type=range] { width: 100%; accent-color: var(--accent-color); }
@media (pointer: coarse) { .breath-view .presets-arrow { display: none; } }
@media (max-height: 560px) { .breath-view .circle { --size: 132px; } .breath-view .app__visual { min-height: 148px; } .breath-view .controls__btn { width: 44px; height: 44px; } }
