:root {
    --bg-color-1: #0B1021;
    --bg-color-2: #1B2A4A;
    --text-primary: #FFFFFF;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --accent: #4FD1C5;
    --circle-base: rgba(79, 209, 197, 0.15);
    --circle-border: rgba(79, 209, 197, 0.4);
    
    --transition-easing: cubic-bezier(0.4, 0.0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body, html {
    height: 100%;
    width: 100%;
    font-family: 'Outfit', sans-serif;
    color: var(--text-primary);
    overflow: hidden;
    background-color: var(--bg-color-1);
}

/* Background animation */
.bg-gradient {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, var(--bg-color-2) 0%, var(--bg-color-1) 50%);
    z-index: 0;
    transition: transform 1s ease;
}

.bg-gradient.inhale {
    transform: scale(1.1);
}
.bg-gradient.exhale {
    transform: scale(0.9);
}

.app-container {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1.5rem;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: max(env(safe-area-inset-top), 10px);
}

.logo {
    font-weight: 600;
    font-size: 1.2rem;
    letter-spacing: 1px;
    opacity: 0.8;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    width: 44px;
    height: 44px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.icon-btn:active {
    opacity: 0.4;
}

/* Breathing Area */
.breathing-zone {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.circle-container {
    position: relative;
    width: 300px;
    height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.glow-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--circle-base);
    filter: blur(20px);
    opacity: 0.5;
    z-index: 1;
}

.breath-circle {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--circle-border);
    background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0) 100%);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 2;
    transform: scale(0.4);
    will-change: transform;
}

.instruction {
    z-index: 3;
    font-size: 2.5rem;
    font-weight: 400;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
    transition: opacity 0.3s ease;
}

.timer {
    z-index: 3;
    font-size: 1.2rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

/* Controls */
.controls {
    padding-bottom: max(env(safe-area-inset-bottom), 2rem);
    display: flex;
    justify-content: center;
}

.primary-btn {
    background: var(--text-primary);
    color: var(--bg-color-1);
    border: none;
    padding: 1rem 3rem;
    border-radius: 30px;
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: transform 0.1s, box-shadow 0.1s;
    min-height: 56px;
    min-width: 200px;
}

.primary-btn:active {
    transform: scale(0.96);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Bottom Sheet */
.bottom-sheet {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    pointer-events: none;
}

.sheet-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sheet-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--bg-color-2);
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    padding: 1.5rem;
    padding-bottom: max(env(safe-area-inset-bottom), 1.5rem);
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.1);
    box-shadow: 0 -5px 25px rgba(0,0,0,0.3);
}

.bottom-sheet.open {
    pointer-events: auto;
}

.bottom-sheet.open .sheet-overlay {
    opacity: 1;
}

.bottom-sheet.open .sheet-content {
    transform: translateY(0);
}

.sheet-handle {
    width: 40px;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    margin: 0 auto 1.5rem;
}

.sheet-content h2 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 400;
}

.setting-group {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
}

.setting-group.toggle-group {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}

.setting-group label {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

select {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    padding: 1rem;
    border-radius: 12px;
    appearance: none;
    outline: none;
    cursor: pointer;
}

.secondary-btn {
    width: 100%;
    background: rgba(255,255,255,0.1);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 12px;
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    cursor: pointer;
    margin-top: 1rem;
    min-height: 50px;
}

/* Custom Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
    margin: 0;
}

.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255,255,255,0.2);
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--accent);
}

input:checked + .slider:before {
    transform: translateX(22px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}