:root {
    --button-size: 3rem;
    --meditation-circle-size: 19em;
    --pie-chart-stroke-width: 41;
}

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

button {
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
}

/* Safari theme switching fix */
body.theme-switching::before,
body.theme-switching::after {
    display: none !important;
    background: none !important;
    background-image: none !important;
    animation: none !important;
}

body {
    font-family: 'Albert Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 300;
    font-size: clamp(16px, calc(16px + (100vw - 360px) * (4 / 290)), 20px);
    height: 100vh;
    max-width: 520px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    user-select: none;
    transition: all 0.6s ease;
}

@media (max-width: 359px) {
    body {
        font-size: 15px;
    }
}


/* Background Effects */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 0;
    transition: all 0.6s ease;
}

.header {
    text-align: center;
    padding: 9px;
    flex: 0.5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header h1 {
    transition: all 0.6s ease;
}

.input-section {
   flex: 0.5;
}

.input-group {
    margin-bottom: 0.625em;
    min-height: 3.125em;
}

.input-group:last-child {
    margin-bottom: 0;
}

#mood-tab {
   padding-top: 4px;
}

.segmented-control {
    display: flex;
    border-radius: 12px;
    overflow: hidden;
    background: transparent;
    backdrop-filter: blur(5px);
    position: relative;
    transition: all 0.3s ease;
    gap: 2px;
    padding: 2px;
    min-height: 46px;
    align-items: center;
    justify-content: space-between;
}

.segmented-option {
    flex: 0 0 auto;
    position: relative;
}

.segmented-option input[type="radio"] {
    display: none;
}

.segmented-option label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
    border-radius: 50%;
    border: 1px solid transparent;
    color: rgba(212, 229, 220, 0.5);
    pointer-events: auto;
    line-height: 1;
    padding-top: 2px; /* Adjust for font baseline offset */
}

.segmented-option label:hover {
    color: rgba(212, 229, 220, 0.75);
}

.segmented-option input[type="radio"]:checked + label {
    width: var(--button-size);
    height: var(--button-size);
    background: transparent;
    color: rgba(212, 229, 220, 0.9);
    box-shadow: none;
}

.time-selector .segmented-control::before,
.theme-selector .segmented-control::before,
.input-group .segmented-control.chimes::before,
.time-selector-combined .segmented-option::before {
    display: none;
}

.time-selector-combined {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    backdrop-filter: blur(5px);
    border-radius: 12px;
    overflow: visible;
    padding: 2px;
    gap: 2px;
    min-height: 3.25rem;
}

.time-separator {
    color: rgba(255, 255, 255, 0.7);
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.segmented-option.time-hours,
.segmented-option.time-minutes {
    flex: 0 0 auto;
    position: relative;
}

.segmented-option.time-hours input[type="radio"],
.segmented-option.time-minutes input[type="radio"] {
    display: none;
}

.segmented-option.time-hours label,
.segmented-option.time-minutes label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
    border-radius: 50%;
    border: 1px solid transparent;
    color: rgba(212, 229, 220, 0.5);
}

.segmented-option.time-hours label:hover,
.segmented-option.time-minutes label:hover {
    color: rgba(212, 229, 220, 0.75);
}

.segmented-option.time-hours input[type="radio"]:checked + label,
.segmented-option.time-minutes input[type="radio"]:checked + label {
    background: transparent;
    color: rgba(212, 229, 220, 0.9);
    box-shadow: none;
}

.segmented-control::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    bottom: 2px;
    width: calc(100% / var(--options) - 4px);
    border-radius: 8px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

.segmented-control.chimes {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    background: transparent;
    backdrop-filter: blur(5px);
    border-radius: 12px;
    padding: 2px;
    gap: 0.5em;
    min-height: 3.25rem;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
}

.segmented-control.chimes::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Edge */
}

.segmented-control.chimes .segmented-option {
    flex-shrink: 0;
    flex: 0 0 auto;
}

/* Mine tab selectors - same styling as chimes */
#mine-tab .segmented-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    backdrop-filter: blur(5px);
    border-radius: 12px;
    padding: 2px;
    gap: 2px;
    min-height: 3.25rem;
}

#mine-tab .segmented-option {
    flex: 0 0 auto;
}

.theme-selector .segmented-control {
    --options: 12;
}

.theme-selector .segmented-option label {
    padding-top: 0; /* Emojis don't need baseline offset */
}

.theme-selector .segmented-control .segmented-option:nth-child(1) input:checked ~ .segmented-control::before {
    transform: translateX(calc(0 * 100%));
}

.theme-selector .segmented-control .segmented-option:nth-child(2) input:checked ~ .segmented-control::before {
    transform: translateX(calc(1 * 100%));
}

.theme-selector .segmented-control .segmented-option:nth-child(3) input:checked ~ .segmented-control::before {
    transform: translateX(calc(2 * 100%));
}

.theme-selector .segmented-control .segmented-option:nth-child(4) input:checked ~ .segmented-control::before {
    transform: translateX(calc(3 * 100%));
}

.theme-selector .segmented-control .segmented-option:nth-child(5) input:checked ~ .segmented-control::before {
    transform: translateX(calc(4 * 100%));
}

.theme-selector .segmented-control .segmented-option:nth-child(6) input:checked ~ .segmented-control::before {
    transform: translateX(calc(5 * 100%));
}

.theme-selector .segmented-control .segmented-option:nth-child(7) input:checked ~ .segmented-control::before {
    transform: translateX(calc(6 * 100%));
}

.theme-selector .segmented-control .segmented-option:nth-child(8) input:checked ~ .segmented-control::before {
    transform: translateX(calc(7 * 100%));
}

.theme-selector .segmented-control .segmented-option:nth-child(9) input:checked ~ .segmented-control::before {
    transform: translateX(calc(8 * 100%));
}

.theme-selector .segmented-control .segmented-option:nth-child(10) input:checked ~ .segmented-control::before {
    transform: translateX(calc(9 * 100%));
}

.theme-selector .segmented-control .segmented-option:nth-child(11) input:checked ~ .segmented-control::before {
    transform: translateX(calc(10 * 100%));
}

.theme-selector .segmented-control .segmented-option:nth-child(12) input:checked ~ .segmented-control::before {
    transform: translateX(calc(11 * 100%));
}

/* Remove all selection indication for theme-selector (mood) */
.theme-selector .segmented-option input[type="radio"]:checked + label {
    background: transparent;
    color: inherit;
    width: 32px;
    height: 32px;
    border-color: transparent;
    box-shadow: none;
}

.meditation-section {
    flex: 4;
    display: flex;
    align-items: center;
    justify-content: center;
}

.meditation-circle {
    border-radius: 50%;
    width: var(--meditation-circle-size);
    height: var(--meditation-circle-size);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.6s ease;
    position: relative;
    flex-shrink: 0;
}

.pie-chart {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    z-index: -1;
    opacity: 0.9;
}

.pie-chart svg {
    width: 100%;
    height: 100%;
    transform: rotate(90deg) scaleX(-1);
}

.pie-chart circle {
    fill: none;
    stroke-width: var(--pie-chart-stroke-width);
    transition: stroke-dasharray 80ms linear;
}

.pie-chart {
    clip-path: circle(50%);
}

.pie-chart .progress-circle {
    stroke-dasharray: 0 879.6;
    stroke-dashoffset: 0;
}

.meditation-circle::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    pointer-events: none;
    z-index: -1;
}

.interval-text {
    opacity: 0.6;
    margin-bottom: 0;
    text-transform: lowercase;
    letter-spacing: 0.25px;
    transition: color 0.6s ease;
}

.interval-number {
    margin: 0.3333em 0;
    transition: all 0.6s ease;
    font-family: 'Overpass Mono', 'Albert Sans', monospace;
    font-weight: 500;
    /* letter-spacing: 0.75px; */
    font-size: 3.3333em;
}

/* Session mode - keep text elements visible and slightly scale counter */
.meditation-section.session-active .interval-text,
.meditation-section.session-active .interval-unit,
.meditation-section.session-active .interval-until {
    opacity: 0.6;
    transform: none;
    transition: all 0.3s ease;
}

.meditation-section.session-active .interval-number {
    transition: all 0.3s ease;
    margin: 1rem 0; /* keep consistent spacing in session */
    position: static;
    top: auto;
    left: auto;
    transform: none;
}


.interval-until {
    opacity: 0.6;
    margin-bottom: 0;
    text-transform: lowercase;
    letter-spacing: 0.25px;
    transition: color 0.6s ease;
}

.interval-unit {
    opacity: 0.6;
    transition: color 0.6s ease;
    text-transform: lowercase;
    margin-bottom: 0;
}

.controls {
    position: relative;
    width: 100%;
    max-width: 700px;
    padding: 1rem;
    transition: all 0.6s ease;
    z-index: 100;
    flex: 2;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.zen-btn {
    width: 100%;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 40px;
    background: transparent;
    cursor: pointer;
    transition: all 0.4s ease;
    text-transform: lowercase;
    font-family: inherit;
}

/* Session active button layout - side by side */
.controls.session-active {
    display: flex;
    flex-direction: row;
    gap: 12px;
    align-items: flex-start;
    justify-content: center;
}

.controls.session-active .zen-btn {
    width: calc(50% - 6px);
    height: auto;
    min-height: 3.25rem;
    flex-shrink: 0;
}

.zen-btn:hover {
    border-color: rgba(255, 255, 255, 0.35);
    transform: translateY(-1px);
}

.zen-btn.primary:hover {
    border-color: rgba(255, 255, 255, 0.4);
}

.zen-btn.warning {
    border-color: rgba(251, 191, 36, 0.4);
    color: #fbbf24;
    box-shadow: inset 0 0 16px rgba(251, 191, 36, 0.1);
}

.zen-btn.warning:hover {
    border-color: rgba(251, 191, 36, 0.5);
    box-shadow: inset 0 0 20px rgba(251, 191, 36, 0.15);
}

.zen-btn.success {
    border-color: rgba(52, 211, 153, 0.4);
    color: #34d399;
    box-shadow: inset 0 0 16px rgba(52, 211, 153, 0.1);
}

.zen-btn.success:hover {
    border-color: rgba(52, 211, 153, 0.5);
    box-shadow: inset 0 0 20px rgba(52, 211, 153, 0.15);
}

.zen-btn.danger {
    border-color: rgba(248, 113, 113, 0.4);
    color: #f87171;
    box-shadow: inset 0 0 16px rgba(248, 113, 113, 0.1);
}

.zen-btn.danger:hover {
    border-color: rgba(248, 113, 113, 0.5);
    box-shadow: inset 0 0 20px rgba(248, 113, 113, 0.15);
}

.hidden {
    display: none;
}

.pulse {
    animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Tab Navigation Styles */
.tab-navigation {
    display: flex;
    background: transparent;
    backdrop-filter: blur(5px);
    gap: 0.1em;
    padding: 0.1em;
    margin-bottom: 0.5em;
    justify-content: space-evenly;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

.tab-button {
    padding: 0.75em 1.35rem;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5em;
    color: rgba(212, 229, 220, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25em;
    pointer-events: auto;
    letter-spacing: 0.05em;
    font-size: inherit;
}

.tab-button svg {
    width: 16px;
    height: 16px;
    opacity: 0.7;
}

.tab-button:hover {
    color: rgba(212, 229, 220, 0.75);
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
}

.tab-button:hover svg {
    opacity: 0.9;
}

.tab-button.active {
    background: transparent;
    color: rgba(212, 229, 220, 0.9);
    box-shadow: none;
}

.tab-button.active svg {
    opacity: 1;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Background-only mode (available on all themes) */
body.background-only-mode .header,
body.background-only-mode .input-section,
body.background-only-mode .meditation-section,
body.background-only-mode .controls {
    opacity: 0;
    transition: opacity 0.8s ease;
    pointer-events: none;
}

body:not(.background-only-mode) .header,
body:not(.background-only-mode) .input-section,
body:not(.background-only-mode) .meditation-section,
body:not(.background-only-mode) .controls {
    opacity: 1;
    transition: opacity 0.8s ease;
}
